asoc: bolero: Update SWR TX moved to AO region

In bengal target, SWR TX moved to AO region.
Update SWR TX as child of VA macro and handle
respective SWR register/clock sequences from
VA macro.

Change-Id: I6b632ce56a885f2ccc8516840b0e5d270fe0b2c0
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
This commit is contained in:
Laxminath Kasam
2019-10-12 01:36:30 +05:30
parent 4651dcbbb0
commit 2e13d64340
6 changed files with 575 additions and 22 deletions

View File

@@ -161,6 +161,7 @@ struct tx_macro_priv {
s32 dmic_6_7_clk_cnt;
u16 dmic_clk_div;
u32 version;
u32 is_used_tx_swr_gpio;
unsigned long active_ch_mask[TX_MACRO_MAX_DAIS];
unsigned long active_ch_cnt[TX_MACRO_MAX_DAIS];
char __iomem *tx_io_base;
@@ -3046,19 +3047,21 @@ static int tx_macro_probe(struct platform_device *pdev)
sample_rate, tx_priv) == TX_MACRO_DMIC_SAMPLE_RATE_UNDEFINED)
return -EINVAL;
}
tx_priv->reset_swr = true;
INIT_WORK(&tx_priv->tx_macro_add_child_devices_work,
tx_macro_add_child_devices);
tx_priv->swr_plat_data.handle = (void *) tx_priv;
tx_priv->swr_plat_data.read = NULL;
tx_priv->swr_plat_data.write = NULL;
tx_priv->swr_plat_data.bulk_write = NULL;
tx_priv->swr_plat_data.clk = tx_macro_swrm_clock;
tx_priv->swr_plat_data.core_vote = tx_macro_core_vote;
tx_priv->swr_plat_data.handle_irq = NULL;
if (is_used_tx_swr_gpio) {
tx_priv->reset_swr = true;
INIT_WORK(&tx_priv->tx_macro_add_child_devices_work,
tx_macro_add_child_devices);
tx_priv->swr_plat_data.handle = (void *) tx_priv;
tx_priv->swr_plat_data.read = NULL;
tx_priv->swr_plat_data.write = NULL;
tx_priv->swr_plat_data.bulk_write = NULL;
tx_priv->swr_plat_data.clk = tx_macro_swrm_clock;
tx_priv->swr_plat_data.core_vote = tx_macro_core_vote;
tx_priv->swr_plat_data.handle_irq = NULL;
mutex_init(&tx_priv->swr_clk_lock);
}
tx_priv->is_used_tx_swr_gpio = is_used_tx_swr_gpio;
mutex_init(&tx_priv->mclk_lock);
mutex_init(&tx_priv->swr_clk_lock);
tx_macro_init_ops(&ops, tx_io_base);
ops.clk_id_req = TX_CORE_CLK;
ops.default_clk_id = TX_CORE_CLK;
@@ -3068,8 +3071,8 @@ static int tx_macro_probe(struct platform_device *pdev)
"%s: register macro failed\n", __func__);
goto err_reg_macro;
}
schedule_work(&tx_priv->tx_macro_add_child_devices_work);
if (is_used_tx_swr_gpio)
schedule_work(&tx_priv->tx_macro_add_child_devices_work);
pm_runtime_set_autosuspend_delay(&pdev->dev, AUTO_SUSPEND_DELAY);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
@@ -3079,7 +3082,8 @@ static int tx_macro_probe(struct platform_device *pdev)
return 0;
err_reg_macro:
mutex_destroy(&tx_priv->mclk_lock);
mutex_destroy(&tx_priv->swr_clk_lock);
if (is_used_tx_swr_gpio)
mutex_destroy(&tx_priv->swr_clk_lock);
return ret;
}
@@ -3093,16 +3097,20 @@ static int tx_macro_remove(struct platform_device *pdev)
if (!tx_priv)
return -EINVAL;
if (tx_priv->swr_ctrl_data)
kfree(tx_priv->swr_ctrl_data);
for (count = 0; count < tx_priv->child_count &&
count < TX_MACRO_CHILD_DEVICES_MAX; count++)
platform_device_unregister(tx_priv->pdev_child_devices[count]);
if (tx_priv->is_used_tx_swr_gpio) {
if (tx_priv->swr_ctrl_data)
kfree(tx_priv->swr_ctrl_data);
for (count = 0; count < tx_priv->child_count &&
count < TX_MACRO_CHILD_DEVICES_MAX; count++)
platform_device_unregister(
tx_priv->pdev_child_devices[count]);
}
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
mutex_destroy(&tx_priv->mclk_lock);
mutex_destroy(&tx_priv->swr_clk_lock);
if (tx_priv->is_used_tx_swr_gpio)
mutex_destroy(&tx_priv->swr_clk_lock);
bolero_unregister_macro(&pdev->dev, TX_MACRO);
return 0;
}