Revert "agm: changes to enable session flush using sessionId"

This reverts commit 9a2e818eef577e2d18846defc189b5e6a8ca9780.

SM8550 devices are still using older kalama tags, where this breaking
interface change is not yet present.

Change-Id: I9e36286075fa0e9aa4e8b598333c032451ca5ed3
diff --git a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
index 49860a0..9b2d1d0 100644
--- a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
@@ -314,16 +314,6 @@
     return -EINVAL;
 }
 
-int agm_sessionid_flush(uint32_t session_id)
-{
-    ALOGV("%s called with session id = %d", __func__, session_id);
-    if (!agm_server_died) {
-        android::sp<IAGM> agm_client = get_agm_server();
-        return agm_client->ipc_agm_sessionid_flush(session_id);
-    }
-    return -EINVAL;
-}
-
 int agm_session_resume(uint64_t handle){
     ALOGV("%s called with handle = %llx \n", __func__, (unsigned long long) handle);
     if (!agm_server_died) {
diff --git a/ipc/HwBinders/agm_ipc_service/inc/agm_server_wrapper.h b/ipc/HwBinders/agm_ipc_service/inc/agm_server_wrapper.h
index 4c31633..9ad0a2d 100644
--- a/ipc/HwBinders/agm_ipc_service/inc/agm_server_wrapper.h
+++ b/ipc/HwBinders/agm_ipc_service/inc/agm_server_wrapper.h
@@ -200,7 +200,6 @@
     Return<int32_t> ipc_agm_session_stop(uint64_t hndl) override;
     Return<int32_t> ipc_agm_session_pause(uint64_t hndl) override;
     Return<int32_t> ipc_agm_session_flush(uint64_t hndl) override;
-    Return<int32_t> ipc_agm_sessionid_flush(uint32_t session_id) override;
     Return<int32_t> ipc_agm_session_resume(uint64_t hndl) override;
     Return<int32_t> ipc_agm_session_suspend(uint64_t hndl) override;
     Return<void> ipc_agm_session_read(uint64_t hndl, uint32_t count,
diff --git a/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp b/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
index ccf047e..78b83f0 100644
--- a/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
@@ -1070,12 +1070,6 @@
     return agm_session_flush(hndl);
 }
 
-Return<int32_t> AGM::ipc_agm_sessionid_flush(uint32_t session_id) {
-    ALOGV("%s called with session id = %d", __func__, session_id);
-
-    return agm_sessionid_flush(session_id);
-}
-
 Return<int32_t> AGM::ipc_agm_session_resume(uint64_t hndl) {
     ALOGV("%s called with handle = %llx \n", __func__, (unsigned long long) hndl);
 
diff --git a/ipc/HwBinders/interfaces/AGMIPC/1.0/IAGM.hal b/ipc/HwBinders/interfaces/AGMIPC/1.0/IAGM.hal
index 280cc5d..0e797a4 100644
--- a/ipc/HwBinders/interfaces/AGMIPC/1.0/IAGM.hal
+++ b/ipc/HwBinders/interfaces/AGMIPC/1.0/IAGM.hal
@@ -125,7 +125,6 @@
     ipc_agm_session_stop(uint64_t hndl) generates (int32_t ret);
     ipc_agm_session_pause(uint64_t hndl) generates (int32_t ret);
     ipc_agm_session_flush(uint64_t hndl) generates (int32_t ret);
-    ipc_agm_sessionid_flush(uint32_t session_id) generates (int32_t ret);
     ipc_agm_session_resume(uint64_t hndl) generates (int32_t ret);
     ipc_agm_session_suspend(uint64_t hndl) generates (int32_t ret);
     ipc_agm_session_read(uint64_t hndl, uint32_t count)
diff --git a/ipc/HwBinders/interfaces/AGMIPC/current.txt b/ipc/HwBinders/interfaces/AGMIPC/current.txt
index 8eae287..ae21480 100644
--- a/ipc/HwBinders/interfaces/AGMIPC/current.txt
+++ b/ipc/HwBinders/interfaces/AGMIPC/current.txt
@@ -1,4 +1,4 @@
 # Hash for vendor.qti.hardware.AGMIPC@1.0 package
 1846dac975898187405fcd011ea43c98415334e187a74a2e4fcaea123e0064b7 vendor.qti.hardware.AGMIPC@1.0::types
-a1545123ef5e6f4536cd2f2902c74a202b39bac323bcbc0ed703ab1437056d4c vendor.qti.hardware.AGMIPC@1.0::IAGM
+c75ed15965f38d53fe69c0a641fb7c9ae043560cb5dcd4e73ea31499251a8dc5 vendor.qti.hardware.AGMIPC@1.0::IAGM
 e8d1ca223a57cfacc7373f6418555330bb545c43a1e9d2c3a1fdd984fcec4a14 vendor.qti.hardware.AGMIPC@1.0::IAGMCallback
diff --git a/plugins/tinyalsa/src/agm_mixer_plugin.c b/plugins/tinyalsa/src/agm_mixer_plugin.c
index 1cd1e16..49ef382 100644
--- a/plugins/tinyalsa/src/agm_mixer_plugin.c
+++ b/plugins/tinyalsa/src/agm_mixer_plugin.c
@@ -144,19 +144,17 @@
     "loopback",
     "echoReference",
     "bufTimestamp",
-    /* Add new ones here, be sure to update enum as well */
+    /* Add new ones here, be sue to update enum as well */
 };
 
 enum {
     PCM_RX_CTL_NAME_SIDETONE = 0,
     PCM_RX_CTL_NAME_DATAPATH_PARAMS,
-    PCM_RX_CTL_NAME_FLUSH,
 };
 /* strings should be at the index as per the enum */
 static char *amp_pcm_rx_ctl_names[] = {
     "sidetone",
     "datapathParams",
-    "flush",
 };
 
 struct amp_get_param_info {
@@ -1681,26 +1679,6 @@
     return ret;
 }
 
-/* Dummy implementation for flush_get */
-static int amp_pcm_flush_get(struct mixer_plugin *plugin __unused,
-                struct snd_control *ctl __unused, struct snd_ctl_elem_value *ev __unused)
-{
-    return 0;
-}
-
-static int amp_pcm_flush_put(struct mixer_plugin *plugin,
-                struct snd_control *ctl, struct snd_ctl_elem_value *ev)
-{
-    uint32_t pcm_idx = ctl->private_value;
-    bool flush = !!(ev->value.integer.value[0]);
-    int ret = 0;
-
-    if (flush)
-        ret = agm_sessionid_flush(pcm_idx);
-
-    return ret;
-}
-
 /* 512 max bytes for non-tlv controls, reserving 16 for future use */
 static struct snd_value_bytes pcm_calibration_bytes =
     SND_VALUE_BYTES(512 - 16);
@@ -1737,9 +1715,6 @@
 static struct snd_value_int group_media_fmt_int =
     SND_VALUE_INTEGER(5, 0, 384000, 1);
 
-static struct snd_value_int flush_param_int =
-    SND_VALUE_INTEGER(1, 0, 1, 1);
-
 static struct snd_value_tlv_bytes be_setparam_bytes =
     SND_VALUE_TLV_BYTES(64 * 1024, amp_be_set_param_get, amp_be_set_param_put);
 
@@ -1983,18 +1958,6 @@
             pcm_getacdbtunnel_bytes, pval, pdata);
 }
 
-static void amp_create_pcm_flush_ctl(struct amp_priv *amp_priv,
-    char *name, int ctl_idx, int pval, void *pdata)
-{
-    struct snd_control *ctl = AMP_PRIV_GET_CTL_PTR(amp_priv, ctl_idx);
-    char *ctl_name = AMP_PRIV_GET_CTL_NAME_PTR(amp_priv, ctl_idx);
-
-    snprintf(ctl_name, AIF_NAME_MAX_LEN + 16, "%s %s",
-            name, amp_pcm_rx_ctl_names[PCM_RX_CTL_NAME_FLUSH]);
-
-    INIT_SND_CONTROL_INTEGER(ctl, ctl_name, amp_pcm_flush_get,
-            amp_pcm_flush_put, flush_param_int, pval, pdata);
-}
 
 /* BE related mixer control creations here */
 static void amp_create_metadata_ctl(struct amp_priv *amp_priv,
@@ -2178,8 +2141,6 @@
                         &be_tx_adi->dev_enum, idx, rx_adi);
         amp_create_pcm_write_with_metadata_ctl(amp_priv, name, (*ctl_idx)++,
                         idx, rx_adi);
-        amp_create_pcm_flush_ctl(amp_priv, name, (*ctl_idx)++,
-                        idx, rx_adi);
     }
 
     return 0;
diff --git a/service/inc/private/agm/session_obj.h b/service/inc/private/agm/session_obj.h
index b6969d0..4679117 100644
--- a/service/inc/private/agm/session_obj.h
+++ b/service/inc/private/agm/session_obj.h
@@ -111,7 +111,6 @@
 int session_obj_deinit();
 int session_obj_valid_check(uint64_t hndl);
 int session_obj_get(int session_id, struct session_obj **sess_obj);
-struct session_obj *session_obj_retrieve_from_pool(uint32_t session_id);
 int session_obj_open(uint32_t session_id,
                      enum agm_session_mode sess_mode,
                      struct session_obj **sess_obj);
diff --git a/service/inc/public/agm/agm_api.h b/service/inc/public/agm/agm_api.h
index 3ff08f7..8680fa1 100644
--- a/service/inc/public/agm/agm_api.h
+++ b/service/inc/public/agm/agm_api.h
@@ -960,16 +960,6 @@
 int agm_session_flush(uint64_t hndl);
 
 /**
-  * \brief flush the session. session must be in pause state
-  *        before flushing.
-  *
-  * \param[in] session_id - Valid audio session id
-  *
-  * \return 0 on success, error code otherwise
-  */
-int agm_sessionid_flush(uint32_t session_id);
-
-/**
   * \brief Resume the session. session must be in paused state
   *        before resuming.
   *
diff --git a/service/src/agm.c b/service/src/agm.c
index f718369..f56e7a4 100644
--- a/service/src/agm.c
+++ b/service/src/agm.c
@@ -795,20 +795,6 @@
     return session_obj_flush(handle);
 }
 
-int agm_sessionid_flush(uint32_t session_id)
-{
-    struct session_obj *handle = NULL;
-    int ret = 0;
-
-    handle = session_obj_retrieve_from_pool(session_id);
-    if (!handle) {
-        AGM_LOGE("Incorrect session_id:%d, doesn't match sess_obj from pool",
-                                        session_id);
-        return -EINVAL;
-    }
-    return session_obj_flush(handle);
-}
-
 int agm_session_resume(uint64_t hndl)
 {
     struct session_obj *handle = (struct session_obj *) hndl;