ASoC: Intel: Skylake: Enable firmware reload in suspend
authorJayachandran B <jayachandran.b@intel.com>
Mon, 13 Jun 2016 12:29:01 +0000 (17:59 +0530)
committerMark Brown <broonie@kernel.org>
Tue, 14 Jun 2016 13:59:33 +0000 (14:59 +0100)
Broxton DSP needs retains code loaded during runtime_pm cycles.
But it looses that on suspend cycle, so on resume we need to
download the firmware again.

This is done by adding a new flag and based on flag status, we
download the firmware.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/bxt-sst.c
sound/soc/intel/skylake/skl-sst-ipc.h
sound/soc/intel/skylake/skl-sst.c
sound/soc/intel/skylake/skl.c

index 46235b93e4f8deccc3c64e8ea2db2aa6dde34afa..e50bac74f4a89700054f78f546b522b8bbf36eff 100644 (file)
@@ -185,6 +185,7 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)
                } else {
                        skl_dsp_set_state_locked(ctx, SKL_DSP_RUNNING);
                        ret = 0;
+                       skl->fw_loaded = true;
                }
        }
 
@@ -200,6 +201,14 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx)
 
        skl->boot_complete = false;
 
+       if (skl->fw_loaded == false) {
+               dev_dbg(ctx->dev, "Re-loading fw\n");
+               ret = bxt_load_base_firmware(ctx);
+               if (ret < 0)
+                       dev_err(ctx->dev, "reload fw failed: %d\n", ret);
+               return ret;
+       }
+
        ret = skl_dsp_enable_core(ctx);
        if (ret < 0) {
                dev_err(ctx->dev, "enable dsp core failed ret: %d\n", ret);
index 9f24261abf3eb3be225dad499982345360afcacf..5102c7b415fe7d148207d80aa79fed4f586bcadf 100644 (file)
@@ -63,6 +63,9 @@ struct skl_sst {
 
        /* Populate module information */
        struct list_head uuid_list;
+
+       /* Is firmware loaded */
+       bool fw_loaded;
 };
 
 struct skl_ipc_init_instance_msg {
index 4cabae54a71e271b85a882bbcf763529107d7063..dff1076a5f9e1abdb039637f2f0cbc44768be783 100644 (file)
@@ -153,6 +153,7 @@ static int skl_load_base_firmware(struct sst_dsp *ctx)
 
                dev_dbg(ctx->dev, "Download firmware successful%d\n", ret);
                skl_dsp_set_state_locked(ctx, SKL_DSP_RUNNING);
+               skl->fw_loaded = true;
        }
        return 0;
 transfer_firmware_failed:
index c0f5d5565deafefbd41242422789c03f84117d20..734072c79205b1f9e6710530e3e8f68e2ea2ac07 100644 (file)
@@ -248,6 +248,7 @@ static int skl_suspend(struct device *dev)
                ret = _skl_suspend(ebus);
                if (ret < 0)
                        return ret;
+               skl->skl_sst->fw_loaded = false;
        }
 
        if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {