asoc: codecs: fix race condition of core vote and reg access

Auto suspend timer for core vote is triggering before read write complete.
Move the auto suspend of core vote to post read write operation.

Change-Id: I758cf57bde4e0b56320ef18f6f17adc655fc8fcb
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha
2021-03-08 14:59:49 +05:30
committed by Gerrit - the friendly Code Review server
parent 45d07c545c
commit 79d3ed87ca
5 changed files with 78 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -725,22 +725,25 @@ done:
static int va_macro_core_vote(void *handle, bool enable)
{
int rc = 0;
struct va_macro_priv *va_priv = (struct va_macro_priv *) handle;
if (va_priv == NULL) {
pr_err("%s: va priv data is NULL\n", __func__);
return -EINVAL;
}
if (enable) {
pm_runtime_get_sync(va_priv->dev);
if (bolero_check_core_votes(va_priv->dev))
rc = 0;
else
rc = -ENOTSYNC;
} else {
pm_runtime_put_autosuspend(va_priv->dev);
pm_runtime_mark_last_busy(va_priv->dev);
}
if (bolero_check_core_votes(va_priv->dev))
return 0;
else
return -EINVAL;
return rc;
}
static int va_macro_swrm_clock(void *handle, bool enable)