Prechádzať zdrojové kódy

asoc: codecs: update VA_MACRO core voting

Update entry for core voting in VA_MACRO.

Change-Id: Iecc1035e04b9cd0f69e33e93643294ba879da63b
Signed-off-by: Harshal Ahire <[email protected]>
Harshal Ahire 5 rokov pred
rodič
commit
021f8805a1
1 zmenil súbory, kde vykonal 22 pridanie a 0 odobranie
  1. 22 0
      asoc/codecs/bolero/va-macro.c

+ 22 - 0
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);
 	}