Merge "ASoC: wcd9335: Fix race during codec master clock (mclk) enablement"
This commit is contained in:
commit
94191debba
1 changed files with 10 additions and 2 deletions
|
@ -842,6 +842,9 @@ struct tasha_priv {
|
|||
int rx_8_count;
|
||||
bool clk_mode;
|
||||
bool clk_internal;
|
||||
|
||||
/* Lock to protect mclk enablement */
|
||||
struct mutex mclk_lock;
|
||||
};
|
||||
|
||||
static int tasha_codec_vote_max_bw(struct snd_soc_codec *codec,
|
||||
|
@ -1152,13 +1155,14 @@ static int tasha_cdc_req_mclk_enable(struct tasha_priv *tasha,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&tasha->mclk_lock);
|
||||
if (enable) {
|
||||
tasha_cdc_sido_ccl_enable(tasha, true);
|
||||
ret = clk_prepare_enable(tasha->wcd_ext_clk);
|
||||
if (ret) {
|
||||
dev_err(tasha->dev, "%s: ext clk enable failed\n",
|
||||
__func__);
|
||||
goto err;
|
||||
goto unlock_mutex;
|
||||
}
|
||||
/* get BG */
|
||||
wcd_resmgr_enable_master_bias(tasha->resmgr);
|
||||
|
@ -1172,7 +1176,8 @@ static int tasha_cdc_req_mclk_enable(struct tasha_priv *tasha,
|
|||
clk_disable_unprepare(tasha->wcd_ext_clk);
|
||||
tasha_cdc_sido_ccl_enable(tasha, false);
|
||||
}
|
||||
err:
|
||||
unlock_mutex:
|
||||
mutex_unlock(&tasha->mclk_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -14114,6 +14119,7 @@ static int tasha_probe(struct platform_device *pdev)
|
|||
mutex_init(&tasha->swr_read_lock);
|
||||
mutex_init(&tasha->swr_write_lock);
|
||||
mutex_init(&tasha->swr_clk_lock);
|
||||
mutex_init(&tasha->mclk_lock);
|
||||
|
||||
cdc_pwr = devm_kzalloc(&pdev->dev, sizeof(struct wcd9xxx_power_region),
|
||||
GFP_KERNEL);
|
||||
|
@ -14199,6 +14205,7 @@ err_clk:
|
|||
err_resmgr:
|
||||
devm_kfree(&pdev->dev, cdc_pwr);
|
||||
err_cdc_pwr:
|
||||
mutex_destroy(&tasha->mclk_lock);
|
||||
devm_kfree(&pdev->dev, tasha);
|
||||
return ret;
|
||||
}
|
||||
|
@ -14213,6 +14220,7 @@ static int tasha_remove(struct platform_device *pdev)
|
|||
clk_put(tasha->wcd_ext_clk);
|
||||
if (tasha->wcd_native_clk)
|
||||
clk_put(tasha->wcd_native_clk);
|
||||
mutex_destroy(&tasha->mclk_lock);
|
||||
devm_kfree(&pdev->dev, tasha);
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue