From d5a26e28f7fb142b70f1dd0ec66518c503eab73d Mon Sep 17 00:00:00 2001 From: Gyeongtaek Lee Date: Thu, 22 Nov 2018 17:06:01 +0900 Subject: [PATCH] [RAMEN9610-11923][COMMON] ASoC: abox: request dram during firmware execution Firmware can access DRAM anytime but current source code only request DRAM during DMA operation. Change-Id: Ie3e8697c863281967aedeb645f886c747ed21e6a Signed-off-by: Gyeongtaek Lee --- sound/soc/samsung/abox/abox.c | 4 ++-- sound/soc/samsung/abox/abox_dump.c | 7 ++----- sound/soc/samsung/abox/abox_gic.c | 4 ++++ sound/soc/samsung/abox/abox_rdma.c | 14 -------------- sound/soc/samsung/abox/abox_vdma.c | 4 ---- sound/soc/samsung/abox/abox_wdma.c | 6 ------ 6 files changed, 8 insertions(+), 31 deletions(-) diff --git a/sound/soc/samsung/abox/abox.c b/sound/soc/samsung/abox/abox.c index 6d640567bc58..750804824be0 100644 --- a/sound/soc/samsung/abox/abox.c +++ b/sound/soc/samsung/abox/abox.c @@ -4390,7 +4390,6 @@ static void abox_boot_done_work_func(struct work_struct *work) abox_restore_data(dev); abox_request_cpu_gear(dev, data, (void *)DEFAULT_CPU_GEAR_ID, ABOX_CPU_GEAR_MIN); - abox_request_dram_on(pdev, dev, false); } static void abox_boot_done(struct device *dev, unsigned int version) @@ -5591,6 +5590,7 @@ error: static int abox_disable(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct abox_data *data = dev_get_drvdata(dev); enum calliope_state state = data->calliope_state; @@ -5609,7 +5609,7 @@ static int abox_disable(struct device *dev) abox_cpu_pm_ipc(dev, false); data->calliope_state = CALLIOPE_DISABLED; abox_log_drain_all(dev); - + abox_request_dram_on(pdev, dev, false); abox_save_register(data); abox_cfg_gpio(dev, "idle"); abox_pad_retention(true); diff --git a/sound/soc/samsung/abox/abox_dump.c b/sound/soc/samsung/abox/abox_dump.c index 8513ad39e856..3c0ab9106d67 100644 --- a/sound/soc/samsung/abox/abox_dump.c +++ b/sound/soc/samsung/abox/abox_dump.c @@ -143,13 +143,10 @@ static ssize_t abox_dump_auto_write(struct file *file, const char __user *data, struct platform_device *pdev_abox; pdev_abox = to_platform_device(abox_dump_dev_abox); - if (enable) { - abox_request_dram_on(pdev_abox, dev, true); + if (enable) pm_runtime_get(dev); - } else { + else pm_runtime_put(dev); - abox_request_dram_on(pdev_abox, dev, false); - } } info->auto_started = enable; diff --git a/sound/soc/samsung/abox/abox_gic.c b/sound/soc/samsung/abox/abox_gic.c index 3205fdc04841..e2f7b11a8a92 100644 --- a/sound/soc/samsung/abox/abox_gic.c +++ b/sound/soc/samsung/abox/abox_gic.c @@ -253,6 +253,10 @@ static int samsung_abox_gic_probe(struct platform_device *pdev) return ret; } + ret = enable_irq_wake(data->irq); + if (ret < 0) + dev_err(dev, "Failed to enable irq wake\n"); + #ifndef CONFIG_PM abox_gic_resume(dev); #endif diff --git a/sound/soc/samsung/abox/abox_rdma.c b/sound/soc/samsung/abox/abox_rdma.c index 049b5d5c858c..719ee45d73e1 100644 --- a/sound/soc/samsung/abox/abox_rdma.c +++ b/sound/soc/samsung/abox/abox_rdma.c @@ -758,8 +758,6 @@ static int abox_rdma_compr_trigger(struct snd_compr_stream *stream, int cmd) if (ret < 0) dev_err(dev, "%s: pause cmd failed(%d)\n", __func__, ret); - - abox_request_dram_on(platform_data->pdev_abox, dev, false); break; case SNDRV_PCM_TRIGGER_STOP: dev_info(dev, "SNDRV_PCM_TRIGGER_STOP\n"); @@ -793,8 +791,6 @@ static int abox_rdma_compr_trigger(struct snd_compr_stream *stream, int cmd) data->byte_offset = 0; data->copied_total = 0; data->received_total = 0; - - abox_request_dram_on(platform_data->pdev_abox, dev, false); break; case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: @@ -803,8 +799,6 @@ static int abox_rdma_compr_trigger(struct snd_compr_stream *stream, int cmd) "SNDRV_PCM_TRIGGER_START" : "SNDRV_PCM_TRIGGER_PAUSE_RELEASE"); - abox_request_dram_on(platform_data->pdev_abox, dev, true); - data->start = 1; ret = abox_rdma_mailbox_send_cmd(dev, CMD_COMPR_START); if (ret < 0) @@ -1479,7 +1473,6 @@ static int abox_rdma_trigger(struct snd_pcm_substream *substream, int cmd) struct snd_soc_platform *platform = rtd->platform; struct device *dev = platform->dev; struct abox_platform_data *data = dev_get_drvdata(dev); - struct snd_pcm_runtime *runtime = substream->runtime; int id = data->id; int ret; ABOX_IPC_MSG msg; @@ -1495,9 +1488,6 @@ static int abox_rdma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - if (memblock_is_memory(runtime->dma_addr)) - abox_request_dram_on(data->pdev_abox, dev, true); - pcmtask_msg->param.trigger = 1; ret = abox_rdma_request_ipc(data, &msg, 1, 0); break; @@ -1515,10 +1505,6 @@ static int abox_rdma_trigger(struct snd_pcm_substream *substream, int cmd) default: break; } - - if (memblock_is_memory(runtime->dma_addr)) - abox_request_dram_on(data->pdev_abox, dev, false); - break; default: ret = -EINVAL; diff --git a/sound/soc/samsung/abox/abox_vdma.c b/sound/soc/samsung/abox/abox_vdma.c index 9befb44e8eee..b3a5e0af19bd 100644 --- a/sound/soc/samsung/abox/abox_vdma.c +++ b/sound/soc/samsung/abox/abox_vdma.c @@ -249,8 +249,6 @@ static int abox_vdma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - if (memblock_is_memory(substream->runtime->dma_addr)) - abox_request_dram_on(pdev_abox, dev, true); pcmtask_msg->param.trigger = 1; ret = abox_vdma_request_ipc(&msg, 1, 0); break; @@ -259,8 +257,6 @@ static int abox_vdma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_PAUSE_PUSH: pcmtask_msg->param.trigger = 0; ret = abox_vdma_request_ipc(&msg, 1, 0); - if (memblock_is_memory(substream->runtime->dma_addr)) - abox_request_dram_on(pdev_abox, dev, false); break; default: dev_err(dev, "invalid command: %d\n", cmd); diff --git a/sound/soc/samsung/abox/abox_wdma.c b/sound/soc/samsung/abox/abox_wdma.c index e7e193256a83..614e8a971914 100644 --- a/sound/soc/samsung/abox/abox_wdma.c +++ b/sound/soc/samsung/abox/abox_wdma.c @@ -290,9 +290,6 @@ static int abox_wdma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - if (memblock_is_memory(substream->runtime->dma_addr)) - abox_request_dram_on(data->pdev_abox, dev, true); - pcmtask_msg->param.trigger = 1; ret = abox_wdma_request_ipc(data, &msg, 1, 0); switch (data->type) { @@ -319,9 +316,6 @@ static int abox_wdma_trigger(struct snd_pcm_substream *substream, int cmd) default: break; } - - if (memblock_is_memory(substream->runtime->dma_addr)) - abox_request_dram_on(data->pdev_abox, dev, false); break; default: ret = -EINVAL; -- 2.20.1