[RAMEN9610-17320][9610] ASoC: abox: added wake_lock to guarantee abox resume completion.
authorShinHyung <s47.kang@samsung.com>
Wed, 5 Jun 2019 08:58:48 +0000 (17:58 +0900)
committerlingsen1 <lingsen1@lenovo.com>
Thu, 31 Oct 2019 03:20:48 +0000 (11:20 +0800)
abox_boot_done_work_func(resume operation) didn't work before starting suspend scequence.
To avoid it, Added wake_lock to guarantee abox resume completion.

Change-Id: I531fbda221aaae4782e786e6e8673a7781803975
Signed-off-by: ShinHyung <s47.kang@samsung.com>
sound/soc/samsung/abox/abox.c
sound/soc/samsung/abox/abox.h

index e0e9d51b13fd491bdb2b6cf3ed8e0e2a651d9148..4b5baa3c9598511effd45efcb5a95d6ece0f8d91 100644 (file)
@@ -3237,6 +3237,7 @@ static void abox_check_cpu_gear(struct device *dev,
                        /* new */
                        dev_dbg(dev, "%s(%p): new\n", __func__, id);
                        pm_wakeup_event(dev_abox, BOOT_DONE_TIMEOUT_MS);
+                       __pm_stay_awake(&data->ws_boot);
                        abox_request_dram_on(pdev, (void *)BOOT_CPU_GEAR_ID, true);
                }
        } else {
@@ -3245,6 +3246,7 @@ static void abox_check_cpu_gear(struct device *dev,
                        /* on */
                        dev_dbg(dev, "%s(%p): on\n", __func__, id);
                        pm_wakeup_event(dev_abox, BOOT_DONE_TIMEOUT_MS);
+                       __pm_stay_awake(&data->ws_boot);
                        abox_request_dram_on(pdev, (void *)BOOT_CPU_GEAR_ID, true);
                } else if ((old_gear < ABOX_CPU_GEAR_MIN) &&
                                (gear >= ABOX_CPU_GEAR_MIN)) {
@@ -4390,6 +4392,9 @@ 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);
+
+       __pm_relax(&data->ws_boot);
+       dev_info(dev, "%s:release wake lock\n", __func__);
 }
 
 static void abox_boot_done(struct device *dev, unsigned int version)
@@ -6043,6 +6048,7 @@ static int samsung_abox_probe(struct platform_device *pdev)
 
        abox_failsafe_init(dev);
 
+       wakeup_source_init(&data->ws_boot, "abox_boot");
        ret = device_create_file(dev, &dev_attr_calliope_version);
        if (ret < 0)
                dev_warn(dev, "Failed to create file: %s\n", "version");
@@ -6093,6 +6099,7 @@ static int samsung_abox_remove(struct platform_device *pdev)
 #ifdef EMULATOR
        iounmap(pmu_alive);
 #endif
+       wakeup_source_trash(&data->ws_boot);
        return 0;
 }
 
index 836d9ad9a5d2500c6bddf9e3480d13c314cab668..e6461a98326b73e5ce4c42a35ab585163055c50d 100644 (file)
@@ -665,6 +665,7 @@ struct abox_data {
        enum audio_mode audio_mode;
        enum sound_type sound_type;
        atomic_t suspend_state;
+       struct wakeup_source ws_boot;
 };
 
 struct abox_compr_data {