[RAMEN9610-11923][COMMON] ASoC: abox: request dram during firmware execution
authorGyeongtaek Lee <gt82.lee@samsung.com>
Thu, 22 Nov 2018 08:06:01 +0000 (17:06 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:15 +0000 (20:23 +0300)
Firmware can access DRAM anytime but current source code
only request DRAM during DMA operation.

Change-Id: Ie3e8697c863281967aedeb645f886c747ed21e6a
Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
sound/soc/samsung/abox/abox.c
sound/soc/samsung/abox/abox_dump.c
sound/soc/samsung/abox/abox_gic.c
sound/soc/samsung/abox/abox_rdma.c
sound/soc/samsung/abox/abox_vdma.c
sound/soc/samsung/abox/abox_wdma.c

index 6d640567bc5827618d38372883af368af45f09d2..750804824be00df732b1693d1b2dfe580812f584 100644 (file)
@@ -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);
index 8513ad39e85696d53c3d6b240f02135d9c91c796..3c0ab9106d6737b65e4b544c83149abdc4bde757 100644 (file)
@@ -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;
index 3205fdc048414fd91b08f1955e40d59cc77a787e..e2f7b11a8a92151bff24e26f32ad182a5f77454b 100644 (file)
@@ -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
index 049b5d5c858c6593e5e1cc3a4e0adafe3f8e4d7c..719ee45d73e1c33c3d3e95f1b877e9e09791da71 100644 (file)
@@ -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;
index 9befb44e8eeef998a75c6fde5e52c8fe04b950e0..b3a5e0af19bdee4f634bbb11b25598b90fc4ebeb 100644 (file)
@@ -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);
index e7e193256a83bd868debf21415e31d9b94dd41c1..614e8a971914768fe91259cf71c084ba53543bf8 100644 (file)
@@ -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;