* [PATCH 01/13] ASoC: core: allow pcms to be registered as nonatomic
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:29 ` [PATCH 02/13] ASoC: Intel: mark cht machine driver with nonatomic trigger Vinod Koul
` (11 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel
Cc: Vinod Koul, Takashi Iwai, broonie, Subhransu S. Prusty, lgirdwood
ALSA core with commit 257f8cce5d40 - "ALSA: pcm: Allow nonatomic trigger
operations" allows trigger ops to implemented as nonatomic. For ASoC, we can
specify this in dailinks and is updated while snd_pcm is created
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
---
include/sound/soc.h | 3 +++
sound/soc/soc-pcm.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index b4fca9aed2a2..3ccab0b7349f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -950,6 +950,9 @@ struct snd_soc_dai_link {
unsigned int symmetric_channels:1;
unsigned int symmetric_samplebits:1;
+ /* Mark this pcm with non atomic ops */
+ bool nonatomic;
+
/* Do not create a PCM for this DAI link (Backend link) */
unsigned int no_pcm:1;
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index eb87d96e2cf0..cef2ff5188d1 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2526,6 +2526,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
/* DAPM dai link stream work */
INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
+ pcm->nonatomic = rtd->dai_link->nonatomic;
rtd->pcm = pcm;
pcm->private_data = rtd;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 02/13] ASoC: Intel: mark cht machine driver with nonatomic trigger
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
2015-02-12 4:29 ` [PATCH 01/13] ASoC: core: allow pcms to be registered as nonatomic Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:29 ` [PATCH 03/13] ASoC: Intel: update MMX ID to 3 Vinod Koul
` (10 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
The DSP messages are sent with nonatomic context, which include trigger
messages, so mark the driver as nonatomic
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/cht_bsw_rt5672.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index ff016621583a..152e7703dd8a 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -218,6 +218,7 @@ static struct snd_soc_dai_link cht_dailink[] = {
.codec_name = "snd-soc-dummy",
.platform_name = "sst-mfld-platform",
.ignore_suspend = 1,
+ .nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
.dpcm_capture = 1,
@@ -240,6 +241,7 @@ static struct snd_soc_dai_link cht_dailink[] = {
.cpu_dai_name = "ssp2-port",
.platform_name = "sst-mfld-platform",
.no_pcm = 1,
+ .nonatomic = true,
.codec_dai_name = "rt5670-aif1",
.codec_name = "i2c-10EC5670:00",
.dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 03/13] ASoC: Intel: update MMX ID to 3
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
2015-02-12 4:29 ` [PATCH 01/13] ASoC: core: allow pcms to be registered as nonatomic Vinod Koul
2015-02-12 4:29 ` [PATCH 02/13] ASoC: Intel: mark cht machine driver with nonatomic trigger Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:29 ` [PATCH 04/13] ASoC: Intel: add support for pause and resume in sst Vinod Koul
` (9 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, lgirdwood
The updated firmware expects the MMX ID to be used as 3, so update the
driver as well
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst-atom-controls.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/sst-atom-controls.h b/sound/soc/intel/sst-atom-controls.h
index dfebfdd5eb2a..daecc58f28af 100644
--- a/sound/soc/intel/sst-atom-controls.h
+++ b/sound/soc/intel/sst-atom-controls.h
@@ -150,7 +150,7 @@ enum sst_cmd_type {
enum sst_task {
SST_TASK_SBA = 1,
- SST_TASK_MMX,
+ SST_TASK_MMX = 3,
};
enum sst_type {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 04/13] ASoC: Intel: add support for pause and resume in sst
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (2 preceding siblings ...)
2015-02-12 4:29 ` [PATCH 03/13] ASoC: Intel: update MMX ID to 3 Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:29 ` [PATCH 05/13] ASoC: Intel: add support for pcm stream suspend/resume Vinod Koul
` (8 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, lgirdwood
This adds missing pcm pause and resume ops in the driver
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst/sst_drv_interface.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/sound/soc/intel/sst/sst_drv_interface.c b/sound/soc/intel/sst/sst_drv_interface.c
index 5f75ef3cdd22..5d56fcdd58d8 100644
--- a/sound/soc/intel/sst/sst_drv_interface.c
+++ b/sound/soc/intel/sst/sst_drv_interface.c
@@ -572,6 +572,35 @@ static int sst_stream_drop(struct device *dev, int str_id)
return sst_drop_stream(ctx, str_id);
}
+static int sst_stream_pause(struct device *dev, int str_id)
+{
+ struct stream_info *str_info;
+ struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+
+ if (ctx->sst_state != SST_FW_RUNNING)
+ return 0;
+
+ str_info = get_stream_info(ctx, str_id);
+ if (!str_info)
+ return -EINVAL;
+
+ return sst_pause_stream(ctx, str_id);
+}
+
+static int sst_stream_resume(struct device *dev, int str_id)
+{
+ struct stream_info *str_info;
+ struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+
+ if (ctx->sst_state != SST_FW_RUNNING)
+ return 0;
+
+ str_info = get_stream_info(ctx, str_id);
+ if (!str_info)
+ return -EINVAL;
+ return sst_resume_stream(ctx, str_id);
+}
+
static int sst_stream_init(struct device *dev, struct pcm_stream_info *str_info)
{
int str_id = 0;
@@ -633,6 +662,8 @@ static struct sst_ops pcm_ops = {
.stream_init = sst_stream_init,
.stream_start = sst_stream_start,
.stream_drop = sst_stream_drop,
+ .stream_pause = sst_stream_pause,
+ .stream_pause_release = sst_stream_resume,
.stream_read_tstamp = sst_read_timestamp,
.send_byte_stream = sst_send_byte_stream,
.close = sst_close_pcm_stream,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 05/13] ASoC: Intel: add support for pcm stream suspend/resume
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (3 preceding siblings ...)
2015-02-12 4:29 ` [PATCH 04/13] ASoC: Intel: add support for pause and resume in sst Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:29 ` [PATCH 06/13] ASoC: Intel: add support for platform suspend Vinod Koul
` (7 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, lgirdwood
The driver didn't implement support for pcm stream suspend and resume, so
add it
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst-mfld-platform-pcm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c
index 7523cbef8780..ea0fa4b90bb0 100644
--- a/sound/soc/intel/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/sst-mfld-platform-pcm.c
@@ -594,11 +594,13 @@ static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
ret_val = stream->ops->stream_drop(sst->dev, str_id);
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ case SNDRV_PCM_TRIGGER_SUSPEND:
dev_dbg(rtd->dev, "sst: in pause\n");
status = SST_PLATFORM_PAUSED;
ret_val = stream->ops->stream_pause(sst->dev, str_id);
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ case SNDRV_PCM_TRIGGER_RESUME:
dev_dbg(rtd->dev, "sst: in pause release\n");
status = SST_PLATFORM_RUNNING;
ret_val = stream->ops->stream_pause_release(sst->dev, str_id);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 06/13] ASoC: Intel: add support for platform suspend
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (4 preceding siblings ...)
2015-02-12 4:29 ` [PATCH 05/13] ASoC: Intel: add support for pcm stream suspend/resume Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:29 ` [PATCH 07/13] ASoC: Intel: save and restore the CSR register Vinod Koul
` (6 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
This adds support for platform suspend and resume. We ensure all pcms are
suspended by invoking snd_soc_suspend() and then stop the DSP
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst-mfld-platform-pcm.c | 58 +++++++++++++++++++++++++++++++
sound/soc/intel/sst-mfld-platform.h | 1 +
2 files changed, 59 insertions(+)
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c
index ea0fa4b90bb0..2fbaf2c75d17 100644
--- a/sound/soc/intel/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/sst-mfld-platform-pcm.c
@@ -667,6 +667,9 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
static int sst_soc_probe(struct snd_soc_platform *platform)
{
+ struct sst_data *drv = dev_get_drvdata(platform->dev);
+
+ drv->soc_card = platform->component.card;
return sst_dsp_init_v2_dpcm(platform);
}
@@ -729,9 +732,64 @@ static int sst_platform_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+
+static int sst_soc_prepare(struct device *dev)
+{
+ struct sst_data *drv = dev_get_drvdata(dev);
+ int i;
+
+ /* suspend all pcms first */
+ snd_soc_suspend(drv->soc_card->dev);
+ snd_soc_poweroff(drv->soc_card->dev);
+
+ /* set the SSPs to idle */
+ for (i = 0; i < drv->soc_card->num_rtd; i++) {
+ struct snd_soc_dai *dai = drv->soc_card->rtd[i].cpu_dai;
+
+ if (dai->active) {
+ send_ssp_cmd(dai, dai->name, 0);
+ sst_handle_vb_timer(dai, false);
+ }
+ }
+
+ return 0;
+}
+
+static void sst_soc_complete(struct device *dev)
+{
+ struct sst_data *drv = dev_get_drvdata(dev);
+ int i;
+
+ /* restart SSPs */
+ for (i = 0; i < drv->soc_card->num_rtd; i++) {
+ struct snd_soc_dai *dai = drv->soc_card->rtd[i].cpu_dai;
+
+ if (dai->active) {
+ sst_handle_vb_timer(dai, true);
+ send_ssp_cmd(dai, dai->name, 1);
+ }
+ }
+ snd_soc_resume(drv->soc_card->dev);
+}
+
+#else
+
+#define sst_soc_prepare NULL
+#define sst_soc_complete NULL
+
+#endif
+
+
+static const struct dev_pm_ops sst_platform_pm = {
+ .prepare = sst_soc_prepare,
+ .complete = sst_soc_complete,
+};
+
static struct platform_driver sst_platform_driver = {
.driver = {
.name = "sst-mfld-platform",
+ .pm = &sst_platform_pm,
},
.probe = sst_platform_probe,
.remove = sst_platform_remove,
diff --git a/sound/soc/intel/sst-mfld-platform.h b/sound/soc/intel/sst-mfld-platform.h
index 79c8d1246a8f..9094314be2b0 100644
--- a/sound/soc/intel/sst-mfld-platform.h
+++ b/sound/soc/intel/sst-mfld-platform.h
@@ -174,6 +174,7 @@ struct sst_data {
struct sst_platform_data *pdata;
struct snd_sst_bytes_v2 *byte_stream;
struct mutex lock;
+ struct snd_soc_card *soc_card;
};
int sst_register_dsp(struct sst_device *sst);
int sst_unregister_dsp(struct sst_device *sst);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 07/13] ASoC: Intel: save and restore the CSR register
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (5 preceding siblings ...)
2015-02-12 4:29 ` [PATCH 06/13] ASoC: Intel: add support for platform suspend Vinod Koul
@ 2015-02-12 4:29 ` Vinod Koul
2015-02-12 4:30 ` [PATCH 08/13] ASoC: Intel: reset the DSP while suspending Vinod Koul
` (5 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:29 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, lgirdwood
The IPC driver saved only IMR register, we need to save the CSR as well, so
add it
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst/sst.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c
index 8a8d56a146e7..0fb1b0ea164c 100644
--- a/sound/soc/intel/sst/sst.c
+++ b/sound/soc/intel/sst/sst.c
@@ -350,7 +350,9 @@ static inline void sst_save_shim64(struct intel_sst_drv *ctx,
spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags);
- shim_regs->imrx = sst_shim_read64(shim, SST_IMRX),
+ shim_regs->imrx = sst_shim_read64(shim, SST_IMRX);
+ shim_regs->csr = sst_shim_read64(shim, SST_CSR);
+
spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags);
}
@@ -367,6 +369,7 @@ static inline void sst_restore_shim64(struct intel_sst_drv *ctx,
*/
spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags);
sst_shim_write64(shim, SST_IMRX, shim_regs->imrx),
+ sst_shim_write64(shim, SST_CSR, shim_regs->csr),
spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 08/13] ASoC: Intel: reset the DSP while suspending
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (6 preceding siblings ...)
2015-02-12 4:29 ` [PATCH 07/13] ASoC: Intel: save and restore the CSR register Vinod Koul
@ 2015-02-12 4:30 ` Vinod Koul
2015-02-12 4:30 ` [PATCH 09/13] ASoC: Intel: Add memcpy32_fromio as well Vinod Koul
` (4 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, lgirdwood
The manual recommends that we reset the DSP when we suspend so add that in
runtime suspend handler
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst/sst.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c
index 0fb1b0ea164c..ea85789641f2 100644
--- a/sound/soc/intel/sst/sst.c
+++ b/sound/soc/intel/sst/sst.c
@@ -412,6 +412,7 @@ static int intel_sst_runtime_suspend(struct device *dev)
synchronize_irq(ctx->irq_num);
flush_workqueue(ctx->post_msg_wq);
+ ctx->ops->reset(ctx);
/* save the shim registers because PMC doesn't save state */
sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 09/13] ASoC: Intel: Add memcpy32_fromio as well
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (7 preceding siblings ...)
2015-02-12 4:30 ` [PATCH 08/13] ASoC: Intel: reset the DSP while suspending Vinod Koul
@ 2015-02-12 4:30 ` Vinod Koul
2015-02-12 4:30 ` [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver Vinod Koul
` (3 subsequent siblings)
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Export 32-bit version of memcpy for use in suspend/resume.
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst/sst.h | 3 +++
sound/soc/intel/sst/sst_loader.c | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/sst/sst.h b/sound/soc/intel/sst/sst.h
index 7f4bbfcbc6f5..9fea01401e65 100644
--- a/sound/soc/intel/sst/sst.h
+++ b/sound/soc/intel/sst/sst.h
@@ -543,4 +543,7 @@ int sst_alloc_drv_context(struct intel_sst_drv **ctx,
int sst_context_init(struct intel_sst_drv *ctx);
void sst_context_cleanup(struct intel_sst_drv *ctx);
void sst_configure_runtime_pm(struct intel_sst_drv *ctx);
+void memcpy32_toio(void __iomem *dst, const void *src, int count);
+void memcpy32_fromio(void *dst, const void __iomem *src, int count);
+
#endif
diff --git a/sound/soc/intel/sst/sst_loader.c b/sound/soc/intel/sst/sst_loader.c
index 7888cd707853..e88907ae8b15 100644
--- a/sound/soc/intel/sst/sst_loader.c
+++ b/sound/soc/intel/sst/sst_loader.c
@@ -39,7 +39,15 @@
#include "sst.h"
#include "../sst-dsp.h"
-static inline void memcpy32_toio(void __iomem *dst, const void *src, int count)
+void memcpy32_toio(void __iomem *dst, const void *src, int count)
+{
+ /* __iowrite32_copy uses 32-bit count values so divide by 4 for
+ * right count in words
+ */
+ __iowrite32_copy(dst, src, count/4);
+}
+
+void memcpy32_fromio(void *dst, const void __iomem *src, int count)
{
/* __iowrite32_copy uses 32-bit count values so divide by 4 for
* right count in words
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (8 preceding siblings ...)
2015-02-12 4:30 ` [PATCH 09/13] ASoC: Intel: Add memcpy32_fromio as well Vinod Koul
@ 2015-02-12 4:30 ` Vinod Koul
2015-02-23 15:45 ` Mark Brown
2015-02-12 4:30 ` [PATCH 11/13] ASoC: Intel: Move the fw download to power_control Vinod Koul
` (2 subsequent siblings)
12 siblings, 1 reply; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
This adds support for system pm support. We need to save the dsp memory
which gets lost on suspend and restore that on resume
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst/sst.c | 128 +++++++++++++++++++++++++++++++++++++++++++++
sound/soc/intel/sst/sst.h | 9 ++++
2 files changed, 137 insertions(+)
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c
index ea85789641f2..6f39f4d4e326 100644
--- a/sound/soc/intel/sst/sst.c
+++ b/sound/soc/intel/sst/sst.c
@@ -419,6 +419,83 @@ static int intel_sst_runtime_suspend(struct device *dev)
return ret;
}
+static int intel_sst_suspend(struct device *dev)
+{
+ struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+ struct sst_fw_save *fw_save;
+ int i, ret = 0;
+
+ /* check first if we are already in SW reset */
+ if (ctx->sst_state == SST_RESET)
+ return 0;
+
+ /*
+ * check if any stream is active and running
+ * they should already by suspend by soc_suspend
+ */
+ for (i = 1; i <= ctx->info.max_streams; i++) {
+ struct stream_info *stream = &ctx->streams[i];
+
+ if (stream->status == STREAM_RUNNING) {
+ dev_err(dev, "stream %d is running, cant susupend, abort\n", i);
+ return -EBUSY;
+ }
+ }
+ synchronize_irq(ctx->irq_num);
+ flush_workqueue(ctx->post_msg_wq);
+
+ /* Move the SST state to Reset */
+ sst_set_fw_state_locked(ctx, SST_RESET);
+
+ /* tell DSP we are suspending */
+ if (ctx->ops->save_dsp_context(ctx))
+ return -EBUSY;
+
+ /* save the memories */
+ fw_save = kzalloc(sizeof(*fw_save), GFP_KERNEL);
+ if (!fw_save)
+ return -ENOMEM;
+ fw_save->iram = kzalloc(ctx->iram_end - ctx->iram_base, GFP_KERNEL);
+ if (!fw_save->iram) {
+ ret = -ENOMEM;
+ goto iram;
+ }
+ fw_save->dram = kzalloc(ctx->dram_end - ctx->dram_base, GFP_KERNEL);
+ if (!fw_save->dram) {
+ ret = -ENOMEM;
+ goto dram;
+ }
+ fw_save->sram = kzalloc(SST_MAILBOX_SIZE, GFP_KERNEL);
+ if (!fw_save->sram) {
+ ret = -ENOMEM;
+ goto sram;
+ }
+
+ fw_save->ddr = kzalloc(ctx->ddr_end - ctx->ddr_base, GFP_KERNEL);
+ if (!fw_save->ddr) {
+ ret = -ENOMEM;
+ goto ddr;
+ }
+
+ memcpy32_fromio(fw_save->iram, ctx->iram, ctx->iram_end - ctx->iram_base);
+ memcpy32_fromio(fw_save->dram, ctx->dram, ctx->dram_end - ctx->dram_base);
+ memcpy32_fromio(fw_save->sram, ctx->mailbox, SST_MAILBOX_SIZE);
+ memcpy32_fromio(fw_save->ddr, ctx->ddr, ctx->ddr_end - ctx->ddr_base);
+
+ ctx->fw_save = fw_save;
+ ctx->ops->reset(ctx);
+ return 0;
+ddr:
+ kfree(fw_save->sram);
+sram:
+ kfree(fw_save->dram);
+dram:
+ kfree(fw_save->iram);
+iram:
+ kfree(fw_save);
+ return ret;
+}
+
static int intel_sst_runtime_resume(struct device *dev)
{
int ret = 0;
@@ -434,7 +511,58 @@ static int intel_sst_runtime_resume(struct device *dev)
return ret;
}
+static int intel_sst_resume(struct device *dev)
+{
+ struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+ struct sst_fw_save *fw_save = ctx->fw_save;
+ int ret = 0;
+ struct sst_block *block;
+
+ if (!fw_save)
+ return intel_sst_runtime_resume(dev);
+
+ sst_set_fw_state_locked(ctx, SST_FW_LOADING);
+
+ /* we have to restore the memory saved */
+ ctx->ops->reset(ctx);
+
+ ctx->fw_save = NULL;
+
+ memcpy32_toio(ctx->iram, fw_save->iram, ctx->iram_end - ctx->iram_base);
+ memcpy32_toio(ctx->dram, fw_save->dram, ctx->dram_end - ctx->dram_base);
+ memcpy32_toio(ctx->mailbox, fw_save->sram, SST_MAILBOX_SIZE);
+ memcpy32_toio(ctx->ddr, fw_save->ddr, ctx->ddr_end - ctx->ddr_base);
+
+ kfree(fw_save->sram);
+ kfree(fw_save->dram);
+ kfree(fw_save->iram);
+ kfree(fw_save->ddr);
+ kfree(fw_save);
+
+ block = sst_create_block(ctx, 0, FW_DWNL_ID);
+ if (block == NULL)
+ return -ENOMEM;
+
+
+ /* start and wait for ack */
+ ctx->ops->start(ctx);
+ ret = sst_wait_timeout(ctx, block);
+ if (ret) {
+ dev_err(ctx->dev, "fw download failed %d\n", ret);
+ /* FW download failed due to timeout */
+ ret = -EBUSY;
+
+ } else {
+ sst_set_fw_state_locked(ctx, SST_FW_RUNNING);
+ }
+
+ sst_free_block(ctx, block);
+ return ret;
+}
+
const struct dev_pm_ops intel_sst_pm = {
+ .suspend = intel_sst_suspend,
+ .resume = intel_sst_resume,
.runtime_suspend = intel_sst_runtime_suspend,
.runtime_resume = intel_sst_runtime_resume,
};
diff --git a/sound/soc/intel/sst/sst.h b/sound/soc/intel/sst/sst.h
index 9fea01401e65..7b3eac426571 100644
--- a/sound/soc/intel/sst/sst.h
+++ b/sound/soc/intel/sst/sst.h
@@ -336,6 +336,13 @@ struct sst_shim_regs64 {
u64 csr2;
};
+struct sst_fw_save {
+ void *iram;
+ void *dram;
+ void *sram;
+ void *ddr;
+};
+
/**
* struct intel_sst_drv - driver ops
*
@@ -427,6 +434,8 @@ struct intel_sst_drv {
* persistent till worker thread gets called
*/
char firmware_name[20];
+
+ struct sst_fw_save *fw_save;
};
/* misc definitions */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver
2015-02-12 4:30 ` [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver Vinod Koul
@ 2015-02-23 15:45 ` Mark Brown
2015-02-23 16:54 ` Vinod Koul
0 siblings, 1 reply; 17+ messages in thread
From: Mark Brown @ 2015-02-23 15:45 UTC (permalink / raw)
To: Vinod Koul; +Cc: alsa-devel, Subhransu S. Prusty, lgirdwood
[-- Attachment #1.1: Type: text/plain, Size: 354 bytes --]
On Thu, Feb 12, 2015 at 10:00:02AM +0530, Vinod Koul wrote:
> This adds support for system pm support. We need to save the dsp memory
> which gets lost on suspend and restore that on resume
This doesn't seem to apply against current code, not entirely sure
what's going on there, can you take a look please? I've applied
everything up to here, thanks!
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver
2015-02-23 15:45 ` Mark Brown
@ 2015-02-23 16:54 ` Vinod Koul
2015-02-24 7:54 ` Mark Brown
0 siblings, 1 reply; 17+ messages in thread
From: Vinod Koul @ 2015-02-23 16:54 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Subhransu S. Prusty, lgirdwood
[-- Attachment #1.1: Type: text/plain, Size: 647 bytes --]
On Tue, Feb 24, 2015 at 12:45:16AM +0900, Mark Brown wrote:
> On Thu, Feb 12, 2015 at 10:00:02AM +0530, Vinod Koul wrote:
> > This adds support for system pm support. We need to save the dsp memory
> > which gets lost on suspend and restore that on resume
>
> This doesn't seem to apply against current code, not entirely sure
> what's going on there, can you take a look please? I've applied
> everything up to here, thanks!
Sure, I will resend the remaining 4 patches. I am not sure why they are conflicting.
Btw where did you apply the 9 patches. I fetched your tree and see 3 in
mark/fix/intel and not rest
Thanks
--
~Vinod
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver
2015-02-23 16:54 ` Vinod Koul
@ 2015-02-24 7:54 ` Mark Brown
0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2015-02-24 7:54 UTC (permalink / raw)
To: Vinod Koul; +Cc: alsa-devel, Subhransu S. Prusty, lgirdwood
[-- Attachment #1.1: Type: text/plain, Size: 433 bytes --]
On Mon, Feb 23, 2015 at 10:24:06PM +0530, Vinod Koul wrote:
> Sure, I will resend the remaining 4 patches. I am not sure why they are conflicting.
> Btw where did you apply the 9 patches. I fetched your tree and see 3 in
> mark/fix/intel and not rest
topic/intel. When I say I've applied things I've applied them locally,
that doesn't mean they're published (especially not when I'm travelling
and internet access can be spotty).
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 11/13] ASoC: Intel: Move the fw download to power_control
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (9 preceding siblings ...)
2015-02-12 4:30 ` [PATCH 10/13] ASoC: Intel: add pm support in sst ipc driver Vinod Koul
@ 2015-02-12 4:30 ` Vinod Koul
2015-02-12 4:30 ` [PATCH 12/13] ASoC: Intel: Remove ignore suspend support Vinod Koul
2015-02-12 4:30 ` [PATCH 13/13] ASoC: Intel: Remove soc pm handling to allow platform driver handle it Vinod Koul
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
Thus removing the runtime_resume handler.
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/sst/sst.c | 18 +-----------------
sound/soc/intel/sst/sst_drv_interface.c | 27 +++++++++++++++++++++++----
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c
index 6f39f4d4e326..10d9f5a72391 100644
--- a/sound/soc/intel/sst/sst.c
+++ b/sound/soc/intel/sst/sst.c
@@ -496,21 +496,6 @@ iram:
return ret;
}
-static int intel_sst_runtime_resume(struct device *dev)
-{
- int ret = 0;
- struct intel_sst_drv *ctx = dev_get_drvdata(dev);
-
- if (ctx->sst_state == SST_RESET) {
- ret = sst_load_fw(ctx);
- if (ret) {
- dev_err(dev, "FW download fail %d\n", ret);
- sst_set_fw_state_locked(ctx, SST_RESET);
- }
- }
- return ret;
-}
-
static int intel_sst_resume(struct device *dev)
{
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
@@ -519,7 +504,7 @@ static int intel_sst_resume(struct device *dev)
struct sst_block *block;
if (!fw_save)
- return intel_sst_runtime_resume(dev);
+ return 0;
sst_set_fw_state_locked(ctx, SST_FW_LOADING);
@@ -564,6 +549,5 @@ const struct dev_pm_ops intel_sst_pm = {
.suspend = intel_sst_suspend,
.resume = intel_sst_resume,
.runtime_suspend = intel_sst_runtime_suspend,
- .runtime_resume = intel_sst_runtime_resume,
};
EXPORT_SYMBOL_GPL(intel_sst_pm);
diff --git a/sound/soc/intel/sst/sst_drv_interface.c b/sound/soc/intel/sst/sst_drv_interface.c
index 5d56fcdd58d8..5c9399160430 100644
--- a/sound/soc/intel/sst/sst_drv_interface.c
+++ b/sound/soc/intel/sst/sst_drv_interface.c
@@ -138,12 +138,31 @@ int sst_get_stream(struct intel_sst_drv *ctx,
static int sst_power_control(struct device *dev, bool state)
{
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+ int ret = 0;
- dev_dbg(ctx->dev, "state:%d", state);
- if (state == true)
- return pm_runtime_get_sync(dev);
- else
+ if (state == true) {
+ ret = pm_runtime_get_sync(dev);
+ dev_dbg(ctx->dev, "Enable: pm usage count: %d\n",
+ atomic_read(&dev->power.usage_count));
+ if (ret < 0) {
+ dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
+ return ret;
+ }
+ if ((ctx->sst_state == SST_RESET) &&
+ (atomic_read(&dev->power.usage_count) == 1)) {
+ ret = sst_load_fw(ctx);
+ if (ret) {
+ dev_err(dev, "FW download fail %d\n", ret);
+ sst_set_fw_state_locked(ctx, SST_RESET);
+ ret = sst_pm_runtime_put(ctx);
+ }
+ }
+ } else {
+ dev_dbg(ctx->dev, "Disable: pm usage count: %d\n",
+ atomic_read(&dev->power.usage_count));
return sst_pm_runtime_put(ctx);
+ }
+ return ret;
}
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 12/13] ASoC: Intel: Remove ignore suspend support
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (10 preceding siblings ...)
2015-02-12 4:30 ` [PATCH 11/13] ASoC: Intel: Move the fw download to power_control Vinod Koul
@ 2015-02-12 4:30 ` Vinod Koul
2015-02-12 4:30 ` [PATCH 13/13] ASoC: Intel: Remove soc pm handling to allow platform driver handle it Vinod Koul
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
In our platform we want platform and codec driver routines to get invoked
and don't need the machine routines so remove here
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/cht_bsw_rt5672.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index 152e7703dd8a..46e7e50f7d74 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -217,7 +217,6 @@ static struct snd_soc_dai_link cht_dailink[] = {
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.platform_name = "sst-mfld-platform",
- .ignore_suspend = 1,
.nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
@@ -248,7 +247,6 @@ static struct snd_soc_dai_link cht_dailink[] = {
| SND_SOC_DAIFMT_CBS_CFS,
.init = cht_codec_init,
.be_hw_params_fixup = cht_codec_fixup,
- .ignore_suspend = 1,
.dpcm_playback = 1,
.dpcm_capture = 1,
.ops = &cht_be_ssp2_ops,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 13/13] ASoC: Intel: Remove soc pm handling to allow platform driver handle it
2015-02-12 4:29 [PATCH 00/13] ASoC: Intel: BSW driver updates Vinod Koul
` (11 preceding siblings ...)
2015-02-12 4:30 ` [PATCH 12/13] ASoC: Intel: Remove ignore suspend support Vinod Koul
@ 2015-02-12 4:30 ` Vinod Koul
12 siblings, 0 replies; 17+ messages in thread
From: Vinod Koul @ 2015-02-12 4:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Vinod Koul, broonie, Subhransu S. Prusty, lgirdwood
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/cht_bsw_rt5672.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index 46e7e50f7d74..d782dcc9f9a7 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -285,7 +285,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
static struct platform_driver snd_cht_mc_driver = {
.driver = {
.name = "cht-bsw-rt5672",
- .pm = &snd_soc_pm_ops,
},
.probe = snd_cht_mc_probe,
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread