From c540b6bf7eff7ed7e228215ac873f97aa24919cd Mon Sep 17 00:00:00 2001 From: ShinHyung Date: Wed, 5 Jun 2019 17:58:48 +0900 Subject: [PATCH] [RAMEN9610-17320][9610] ASoC: abox: added wake_lock to guarantee abox resume completion. 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 --- sound/soc/samsung/abox/abox.c | 7 +++++++ sound/soc/samsung/abox/abox.h | 1 + 2 files changed, 8 insertions(+) diff --git a/sound/soc/samsung/abox/abox.c b/sound/soc/samsung/abox/abox.c index e0e9d51b13fd..4b5baa3c9598 100644 --- a/sound/soc/samsung/abox/abox.c +++ b/sound/soc/samsung/abox/abox.c @@ -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; } diff --git a/sound/soc/samsung/abox/abox.h b/sound/soc/samsung/abox/abox.h index 836d9ad9a5d2..e6461a98326b 100644 --- a/sound/soc/samsung/abox/abox.h +++ b/sound/soc/samsung/abox/abox.h @@ -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 { -- 2.20.1