#include <sound/soc.h>
 #include "skl.h"
 #include "skl-topology.h"
+#include "skl-sst-dsp.h"
+#include "skl-sst-ipc.h"
 
 #define HDA_MONO 1
 #define HDA_STEREO 2
        struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
        struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
        struct skl_dma_params *dma_params = NULL;
+       struct skl *skl = ebus_to_skl(ebus);
 
        dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
 
        snd_soc_dai_set_dma_data(dai, substream, NULL);
        skl_set_suspend_active(substream, dai, false);
 
+       /*
+        * check if close is for "Reference Pin" and set back the
+        * CGCTL.MISCBDCGE if disabled by driver
+        */
+       if (!strncmp(dai->name, "Reference Pin", 13) &&
+                       skl->skl_sst->miscbdcg_disabled) {
+               skl->skl_sst->enable_miscbdcge(dai->dev, true);
+               skl->skl_sst->miscbdcg_disabled = false;
+       }
+
        kfree(dma_params);
 }
 
 
 
 #include "../common/sst-dsp.h"
 #include "../common/sst-dsp-priv.h"
+#include "skl.h"
 #include "skl-sst-dsp.h"
 #include "skl-sst-ipc.h"
+#include "sound/hdaudio_ext.h"
 
 
 #define IPC_IXC_STATUS_BITS            24
                        wake_up(&skl->boot_wait);
                        break;
 
+               case IPC_GLB_NOTIFY_PHRASE_DETECTED:
+                       dev_dbg(ipc->dev, "***** Phrase Detected **********\n");
+
+                       /*
+                        * Per HW recomendation, After phrase detection,
+                        * clear the CGCTL.MISCBDCGE.
+                        *
+                        * This will be set back on stream closure
+                        */
+                       skl->enable_miscbdcge(ipc->dev, false);
+                       skl->miscbdcg_disabled = true;
+                       break;
+
                default:
                        dev_err(ipc->dev, "ipc: Unhandled error msg=%x",
                                                header.primary);