struct hdac_stream *snd_hdac_get_stream(struct hdac_bus *bus,
                                        int dir, int stream_tag);
 
-int snd_hdac_stream_setup(struct hdac_stream *azx_dev);
+int snd_hdac_stream_setup(struct hdac_stream *azx_dev, bool code_loading);
 void snd_hdac_stream_cleanup(struct hdac_stream *azx_dev);
 int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev);
 int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
 
        bool link_locked:1;
        bool link_prepared;
 
-       int (*host_setup)(struct hdac_stream *);
+       int (*host_setup)(struct hdac_stream *, bool);
 
        struct snd_pcm_substream *link_substream;
 };
 void snd_hdac_ext_stream_clear(struct hdac_ext_stream *hext_stream);
 void snd_hdac_ext_stream_reset(struct hdac_ext_stream *hext_stream);
 int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt);
-int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream);
+int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream, bool code_loading);
 
 struct hdac_ext_link {
        struct hdac_bus *bus;
 
 /**
  * snd_hdac_ext_host_stream_setup - Setup a HOST stream.
  * @hext_stream: HDAudio stream to set up.
+ * @code_loading: Whether the stream is for PCM or code-loading.
  *
  * Return: Zero on success or negative error code.
  */
-int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream)
+int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream, bool code_loading)
 {
-       return hext_stream->host_setup(hdac_stream(hext_stream));
+       return hext_stream->host_setup(hdac_stream(hext_stream), code_loading);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_host_stream_setup);
 
  * snd_hdac_apl_host_stream_setup - Setup a HOST stream following procedure
  *                                  recommended for ApolloLake devices.
  * @hstream: HDAudio stream to set up.
+ * @code_loading: Whether the stream is for PCM or code-loading.
  *
  * Return: Zero on success or negative error code.
  */
-static int snd_hdac_apl_host_stream_setup(struct hdac_stream *hstream)
+static int snd_hdac_apl_host_stream_setup(struct hdac_stream *hstream, bool code_loading)
 {
        struct hdac_ext_stream *hext_stream = stream_to_hdac_ext_stream(hstream);
        int ret;
 
        snd_hdac_ext_stream_decouple(hstream->bus, hext_stream, false);
-       ret = snd_hdac_stream_setup(hstream);
+       ret = snd_hdac_stream_setup(hstream, code_loading);
        snd_hdac_ext_stream_decouple(hstream->bus, hext_stream, true);
 
        return ret;
                                 int num_stream, int dir)
 {
        struct pci_dev *pci = to_pci_dev(bus->dev);
-       int (*setup_op)(struct hdac_stream *);
+       int (*setup_op)(struct hdac_stream *, bool);
        int stream_tag = 0;
        int i, tag, idx = start_idx;
 
 
 /**
  * snd_hdac_stream_setup -  set up the SD for streaming
  * @azx_dev: HD-audio core stream to set up
+ * @code_loading: Whether the stream is for PCM or code-loading.
  */
-int snd_hdac_stream_setup(struct hdac_stream *azx_dev)
+int snd_hdac_stream_setup(struct hdac_stream *azx_dev, bool code_loading)
 {
        struct hdac_bus *bus = azx_dev->bus;
        struct snd_pcm_runtime *runtime;
        /* set the interrupt enable bits in the descriptor control register */
        snd_hdac_stream_updatel(azx_dev, SD_CTL, 0, SD_INT_MASK);
 
-       /* Once SDxFMT is set, the controller programs SDxFIFOS to non-zero value. */
-       ret = snd_hdac_stream_readw_poll(azx_dev, SD_FIFOSIZE, reg, reg & AZX_SD_FIFOSIZE_MASK,
-                                        3, 300);
-       if (ret)
-               dev_dbg(bus->dev, "polling SD_FIFOSIZE 0x%04x failed: %d\n",
-                       AZX_REG_SD_FIFOSIZE, ret);
-       azx_dev->fifo_size = snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE);
+       if (!code_loading) {
+               /* Once SDxFMT is set, the controller programs SDxFIFOS to non-zero value. */
+               ret = snd_hdac_stream_readw_poll(azx_dev, SD_FIFOSIZE, reg,
+                                                reg & AZX_SD_FIFOSIZE_MASK, 3, 300);
+               if (ret)
+                       dev_dbg(bus->dev, "polling SD_FIFOSIZE 0x%04x failed: %d\n",
+                               AZX_REG_SD_FIFOSIZE, ret);
+               azx_dev->fifo_size = reg;
+       }
 
        /* when LPIB delay correction gives a small negative value,
         * we ignore it; currently set the threshold statically to
        if (err < 0)
                goto error;
 
-       snd_hdac_stream_setup(azx_dev);
+       snd_hdac_stream_setup(azx_dev, true);
        snd_hdac_dsp_unlock(azx_dev);
        return azx_dev->stream_tag;
 
 
        if (err < 0)
                goto unlock;
 
-       snd_hdac_stream_setup(azx_stream(azx_dev));
+       snd_hdac_stream_setup(azx_stream(azx_dev), false);
 
        stream_tag = azx_dev->core.stream_tag;
        /* CA-IBG chips need the playback stream starting from 1 */
 
        if (ret < 0)
                return ret;
 
-       ret = snd_hdac_ext_host_stream_setup(host_stream);
+       ret = snd_hdac_ext_host_stream_setup(host_stream, false);
        if (ret < 0)
                return ret;
 
 
        ret = snd_hdac_stream_set_params(hdac_stream(host_stream), format_val);
        if (ret < 0)
                return ret;
-       ret = snd_hdac_stream_setup(hdac_stream(host_stream));
+       ret = snd_hdac_stream_setup(hdac_stream(host_stream), false);
        if (ret < 0)
                return ret;
 
 
        if (err < 0)
                return err;
 
-       err = snd_hdac_ext_host_stream_setup(stream);
+       err = snd_hdac_ext_host_stream_setup(stream, false);
        if (err < 0)
                return err;