agm: Add support for echo reference capture
Add new backend definition
Add function to configure echo reference backend
Change-Id: I2dc4592e9cbfbae98354fae7f1d34b031859078f
diff --git a/service/inc/private/agm/device.h b/service/inc/private/agm/device.h
index 7dadaf8..5546720 100644
--- a/service/inc/private/agm/device.h
+++ b/service/inc/private/agm/device.h
@@ -25,6 +25,39 @@
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+** Changes from Qualcomm Innovation Center are provided under the following license:
+** Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted (subject to the limitations in the
+** disclaimer below) provided that the following conditions are met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** * Redistributions in binary form must reproduce the above
+** copyright notice, this list of conditions and the following
+** disclaimer in the documentation and/or other materials provided
+** with the distribution.
+**
+** * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+** GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+** IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
#ifndef __AGM_DEVICE_H__
@@ -55,6 +88,7 @@
#define USB_AUDIO 0x6
#define PCM_RT_PROXY 0x7
#define AUDIOSS_DMA 0x8
+#define PCM_DUMMY 0x9
#define AUDIO_OUTPUT 0x1 /**< playback usecases*/
#define AUDIO_INPUT 0x2 /**< capture/voice activation usecases*/
@@ -102,11 +136,17 @@
uint32_t dev_id;
};
+struct hw_ep_pcm_dummy_config {
+ /* PCM dummy device id */
+ uint32_t dev_id;
+};
+
union hw_ep_config {
struct hw_ep_cdc_dma_i2s_tdm_config cdc_dma_i2s_tdm_config;
struct hw_ep_slimbus_config slim_config;
struct hw_ep_pcm_rt_proxy_config pcm_rt_proxy_config;
struct hw_ep_audioss_dma_config audioss_dma_config;
+ struct hw_ep_pcm_dummy_config pcm_dummy_config;
};
typedef struct hw_ep_info
diff --git a/service/src/device_hw_ep.c b/service/src/device_hw_ep.c
index 4e001c0..155f0a0 100644
--- a/service/src/device_hw_ep.c
+++ b/service/src/device_hw_ep.c
@@ -25,6 +25,39 @@
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+** Changes from Qualcomm Innovation Center are provided under the following license:
+** Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted (subject to the limitations in the
+** disclaimer below) provided that the following conditions are met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+**
+** * Redistributions in binary form must reproduce the above
+** copyright notice, this list of conditions and the following
+** disclaimer in the documentation and/or other materials provided
+** with the distribution.
+**
+** * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+** GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+** IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
#define LOG_TAG "AGM: device"
@@ -143,6 +176,8 @@
hw_ep_info->intf = PCM_RT_PROXY;
else if (!strcmp(intf, "AUDIOSS_DMA"))
hw_ep_info->intf = AUDIOSS_DMA;
+ else if (!strcmp(intf, "PCM_DUMMY"))
+ hw_ep_info->intf = PCM_DUMMY;
else {
AGM_LOGE("No matching intf found\n");
return -EINVAL;
@@ -217,6 +252,26 @@
return ret;
}
+static int populate_pcm_dummy_ep_info(hw_ep_info_t *hw_ep_info, char *value)
+{
+ char arg[DEV_ARG_SIZE] = {0};
+ struct hw_ep_pcm_dummy_config *pcm_dummy_config;
+ int ret = 0;
+
+ sscanf(value, "%20[^-]-%60s", arg, value);
+ ret = populate_hw_ep_direction(hw_ep_info, arg);
+ if (ret) {
+ AGM_LOGE("failed to parse direction\n");
+ return ret;
+ }
+
+ pcm_dummy_config = &hw_ep_info->ep_config.pcm_dummy_config;
+ sscanf(value, "%20[^-]-%60s", arg, value);
+ pcm_dummy_config->dev_id = atoi(arg);
+
+ return ret;
+}
+
static int populate_slim_dp_usb_ep_info(hw_ep_info_t *hw_ep_info, char *value)
{
char dir[DEV_ARG_SIZE], arg[DEV_ARG_SIZE] = {0};
@@ -358,6 +413,8 @@
return populate_pcm_rt_proxy_ep_info(&dev_obj->hw_ep_info, value);
case AUDIOSS_DMA:
return populate_audioss_dma_ep_info(&dev_obj->hw_ep_info, value);
+ case PCM_DUMMY:
+ return populate_pcm_dummy_ep_info(&dev_obj->hw_ep_info, value);
default:
AGM_LOGE("Unsupported interface name %s\n", __func__, dev_obj->name);
return -EINVAL;
diff --git a/service/src/graph_module.c b/service/src/graph_module.c
index 63dbfd4..83e5c10 100644
--- a/service/src/graph_module.c
+++ b/service/src/graph_module.c
@@ -26,6 +26,39 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define LOG_TAG "AGM: graph_module"
@@ -677,7 +710,7 @@
int ret = 0;
struct device_obj *dev_obj = mod->dev_obj;
- if(dev_obj->hw_ep_info.intf == PCM_RT_PROXY) {
+ if(dev_obj->hw_ep_info.intf == PCM_RT_PROXY || dev_obj->hw_ep_info.intf == PCM_DUMMY) {
AGM_LOGD("no ep media config for %d\n", dev_obj->hw_ep_info.intf);
}
else {
@@ -713,6 +746,9 @@
case AUDIOSS_DMA:
AGM_LOGD("no ep configuration for %d\n", dev_obj->hw_ep_info.intf);
break;
+ case PCM_DUMMY:
+ AGM_LOGD("no ep configuration for %d\n", dev_obj->hw_ep_info.intf);
+ break;
default:
AGM_LOGE("hw intf %d not enabled yet", dev_obj->hw_ep_info.intf);
break;