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

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

Merge "asoc: bolero: Ensure va-macro is registered before other macros"

parents 4ff65164 251ce993
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -600,6 +600,28 @@ int bolero_dmic_clk_enable(struct snd_soc_component *component,
}
EXPORT_SYMBOL(bolero_dmic_clk_enable);

bool bolero_is_va_macro_registered(struct device *dev)
{
	struct bolero_priv *priv;

	if (!dev) {
		pr_err("%s: dev is null\n", __func__);
		return false;
	}
	if (!bolero_is_valid_child_dev(dev)) {
		dev_err(dev, "%s: child device calling is not added yet\n",
			__func__);
		return false;
	}
	priv = dev_get_drvdata(dev->parent);
	if (!priv) {
		dev_err(dev, "%s: priv is null\n", __func__);
		return false;
	}
	return priv->macros_supported[VA_MACRO];
}
EXPORT_SYMBOL(bolero_is_va_macro_registered);

/**
 * bolero_register_macro - Registers macro to bolero
 *
@@ -661,7 +683,7 @@ int bolero_register_macro(struct device *dev, u16 macro_id,
	priv->num_macros_registered++;
	priv->macros_supported[macro_id] = true;

	dev_dbg(dev, "%s: register macro successful:%d\n", __func__, macro_id);
	dev_info(dev, "%s: register macro successful:%d\n", __func__, macro_id);

	if (priv->num_macros_registered == priv->num_macros) {
		ret = bolero_copy_dais_from_macro(priv);
+6 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ typedef int (*rsc_clk_cb_t)(struct device *dev, u16 event);
#if IS_ENABLED(CONFIG_SND_SOC_BOLERO)
int bolero_register_res_clk(struct device *dev, rsc_clk_cb_t cb);
void bolero_unregister_res_clk(struct device *dev);
bool bolero_is_va_macro_registered(struct device *dev);
int bolero_register_macro(struct device *dev, u16 macro_id,
			  struct macro_ops *ops);
void bolero_unregister_macro(struct device *dev, u16 macro_id);
@@ -132,6 +133,11 @@ static inline void bolero_unregister_res_clk(struct device *dev)
{
}

static bool bolero_is_va_macro_registered(struct device *dev)
{
	return false;
}

static inline int bolero_register_macro(struct device *dev,
					u16 macro_id,
					struct macro_ops *ops)
+6 −0
Original line number Diff line number Diff line
@@ -3994,6 +3994,12 @@ static int rx_macro_probe(struct platform_device *pdev)
	u32 is_used_rx_swr_gpio = 1;
	const char *is_used_rx_swr_gpio_dt = "qcom,is-used-swr-gpio";

	if (!bolero_is_va_macro_registered(&pdev->dev)) {
		dev_err(&pdev->dev,
			"%s: va-macro not registered yet, defer\n", __func__);
		return -EPROBE_DEFER;
	}

	rx_priv = devm_kzalloc(&pdev->dev, sizeof(struct rx_macro_priv),
			    GFP_KERNEL);
	if (!rx_priv)
+6 −0
Original line number Diff line number Diff line
@@ -3191,6 +3191,12 @@ static int tx_macro_probe(struct platform_device *pdev)
	u32 is_used_tx_swr_gpio = 1;
	const char *is_used_tx_swr_gpio_dt = "qcom,is-used-swr-gpio";

	if (!bolero_is_va_macro_registered(&pdev->dev)) {
		dev_err(&pdev->dev,
			"%s: va-macro not registered yet, defer\n", __func__);
		return -EPROBE_DEFER;
	}

	tx_priv = devm_kzalloc(&pdev->dev, sizeof(struct tx_macro_priv),
			    GFP_KERNEL);
	if (!tx_priv)
+7 −0
Original line number Diff line number Diff line
@@ -3144,6 +3144,12 @@ static int wsa_macro_probe(struct platform_device *pdev)
	u32 is_used_wsa_swr_gpio = 1;
	const char *is_used_wsa_swr_gpio_dt = "qcom,is-used-swr-gpio";

	if (!bolero_is_va_macro_registered(&pdev->dev)) {
		dev_err(&pdev->dev,
			"%s: va-macro not registered yet, defer\n", __func__);
		return -EPROBE_DEFER;
	}

	wsa_priv = devm_kzalloc(&pdev->dev, sizeof(struct wsa_macro_priv),
				GFP_KERNEL);
	if (!wsa_priv)
@@ -3227,6 +3233,7 @@ static int wsa_macro_probe(struct platform_device *pdev)
	wsa_macro_init_ops(&ops, wsa_io_base);
	ops.clk_id_req = wsa_priv->default_clk_id;
	ops.default_clk_id = wsa_priv->default_clk_id;

	ret = bolero_register_macro(&pdev->dev, WSA_MACRO, &ops);
	if (ret < 0) {
		dev_err(&pdev->dev, "%s: register macro failed\n", __func__);