Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80875035 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoc: bolero: update logic to disable VA_MCLK"

parents 9a2dd3bd 22110db9
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -184,6 +185,7 @@ struct va_macro_priv {
	int dec_mode[VA_MACRO_NUM_DECIMATORS];
	u16 current_clk_id;
	int pcm_rate[VA_MACRO_NUM_DECIMATORS];
	bool dev_up;
};

static bool va_macro_get_data(struct snd_soc_component *component,
@@ -329,6 +331,7 @@ static int va_macro_event_handler(struct snd_soc_component *component,
		trace_printk("%s, enter SSR up\n", __func__);
		/* reset swr after ssr/pdr */
		va_priv->reset_swr = true;
		va_priv->dev_up = true;
		if (va_priv->swr_ctrl_data)
			swrm_wcd_notify(
				va_priv->swr_ctrl_data[0].va_swr_pdev,
@@ -338,6 +341,8 @@ static int va_macro_event_handler(struct snd_soc_component *component,
		bolero_rsc_clk_reset(va_dev, VA_CORE_CLK);
		break;
	case BOLERO_MACRO_EVT_SSR_DOWN:
		trace_printk("%s: BOLERO_MACRO_EVT_SSR_DOWN\n", __func__);
		va_priv->dev_up = false;
		if (va_priv->swr_ctrl_data) {
			swrm_wcd_notify(
				va_priv->swr_ctrl_data[0].va_swr_pdev,
@@ -441,9 +446,7 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
		}
		break;
	case SND_SOC_DAPM_POST_PMD:
		if (va_priv->current_clk_id == VA_CORE_CLK &&
			va_priv->va_swr_clk_cnt != 0 &&
			va_priv->tx_clk_status) {
		if (va_priv->current_clk_id == VA_CORE_CLK) {
			ret = bolero_clk_rsc_request_clock(va_priv->dev,
					va_priv->default_clk_id,
					TX_CORE_CLK,
@@ -452,6 +455,7 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
				dev_dbg(component->dev,
					"%s: request clock TX_CLK disable failed\n",
					__func__);
				if (va_priv->dev_up)
					break;
			}
			ret = bolero_clk_rsc_request_clock(va_priv->dev,
@@ -462,6 +466,7 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
				dev_dbg(component->dev,
					"%s: request clock VA_CLK disable failed\n",
					__func__);
				if (va_priv->dev_up)
					bolero_clk_rsc_request_clock(va_priv->dev,
						TX_CORE_CLK,
						TX_CORE_CLK,
@@ -2843,6 +2848,8 @@ static int va_macro_init(struct snd_soc_component *component)
	}
	snd_soc_dapm_sync(dapm);

	va_priv->dev_up = true;

	for (i = 0; i < VA_MACRO_NUM_DECIMATORS; i++) {
		va_priv->va_hpf_work[i].va_priv = va_priv;
		va_priv->va_hpf_work[i].decimator = i;