Merge "asoc: codecs: update VA_MACRO core voting"

This commit is contained in:
qctecmdr 2019-11-26 07:24:29 -08:00 committed by Gerrit - the friendly Code Review server
commit 2949887cc6

View file

@ -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 @@ static int va_macro_tx_va_mclk_enable(struct va_macro_priv *va_priv,
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);
}