mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
Merge "asoc: bolero: Ensure va-macro is registered before other macros"
This commit is contained in:
commit
d36eef9148
5 changed files with 48 additions and 1 deletions
|
|
@ -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
|
||||
*
|
||||
|
|
@ -660,7 +682,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", 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);
|
||||
|
|
|
|||
|
|
@ -83,6 +83,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);
|
||||
|
|
@ -113,6 +114,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)
|
||||
|
|
|
|||
|
|
@ -4054,6 +4054,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)
|
||||
|
|
|
|||
|
|
@ -3251,6 +3251,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)
|
||||
|
|
|
|||
|
|
@ -3139,6 +3139,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)
|
||||
|
|
@ -3224,6 +3230,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__);
|
||||
|
|
|
|||
Loading…
Reference in a new issue