diff --git a/asoc/codecs/bolero/va-macro.c b/asoc/codecs/bolero/va-macro.c index c5f0ef9c0373..14bf965ab676 100644 --- a/asoc/codecs/bolero/va-macro.c +++ b/asoc/codecs/bolero/va-macro.c @@ -119,6 +119,7 @@ struct va_macro_swr_ctrl_platform_data { int (*read)(void *handle, int reg); int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); + int (*core_vote)(void *handle, bool enable); int (*clk)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, @@ -603,6 +604,26 @@ done: return ret; } +static int va_macro_core_vote(void *handle, bool enable) +{ + 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); + 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; +} + static int va_macro_swrm_clock(void *handle, bool enable) { struct va_macro_priv *va_priv = (struct va_macro_priv *) handle; @@ -2845,6 +2866,7 @@ static int va_macro_probe(struct platform_device *pdev) va_priv->swr_plat_data.write = NULL; va_priv->swr_plat_data.bulk_write = NULL; va_priv->swr_plat_data.clk = va_macro_swrm_clock; + va_priv->swr_plat_data.core_vote = va_macro_core_vote; va_priv->swr_plat_data.handle_irq = NULL; mutex_init(&va_priv->swr_clk_lock); }