From: ShinHyung Date: Wed, 5 Jun 2019 08:58:48 +0000 (+0900) Subject: [RAMEN9610-19621][9610] ASoC: abox: added wake_lock to guarantee abox resume completion. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d3906c3e0a0c89bc2cf38aa371764fc33732d7d8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [RAMEN9610-19621][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 --- diff --git a/sound/soc/samsung/abox/abox.c b/sound/soc/samsung/abox/abox.c index de54c1382937..089cba7f1438 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) @@ -6039,6 +6044,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"); @@ -6089,6 +6095,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 {