summaryrefslogtreecommitdiff
path: root/asoc
diff options
context:
space:
mode:
Diffstat (limited to 'asoc')
-rw-r--r--asoc/codecs/bolero/bolero-cdc.c2
-rw-r--r--asoc/codecs/bolero/rx-macro.c27
-rw-r--r--asoc/codecs/bolero/tx-macro.c17
-rw-r--r--asoc/codecs/bolero/va-macro.c17
-rw-r--r--asoc/codecs/bolero/wsa-macro.c15
-rw-r--r--asoc/msm-pcm-routing-v2.c15
6 files changed, 62 insertions, 31 deletions
diff --git a/asoc/codecs/bolero/bolero-cdc.c b/asoc/codecs/bolero/bolero-cdc.c
index 53c70fab..e80a8239 100644
--- a/asoc/codecs/bolero/bolero-cdc.c
+++ b/asoc/codecs/bolero/bolero-cdc.c
@@ -1379,7 +1379,6 @@ static int bolero_probe(struct platform_device *pdev)
mutex_init(&priv->vote_lock);
INIT_WORK(&priv->bolero_add_child_devices_work,
bolero_add_child_devices);
- schedule_work(&priv->bolero_add_child_devices_work);
/* Register LPASS core hw vote */
lpass_core_hw_vote = devm_clk_get(&pdev->dev, "lpass_core_hw_vote");
@@ -1403,6 +1402,7 @@ static int bolero_probe(struct platform_device *pdev)
}
priv->lpass_audio_hw_vote = lpass_audio_hw_vote;
+ schedule_work(&priv->bolero_add_child_devices_work);
return 0;
}
diff --git a/asoc/codecs/bolero/rx-macro.c b/asoc/codecs/bolero/rx-macro.c
index 07dd8ada..9934a865 100644
--- a/asoc/codecs/bolero/rx-macro.c
+++ b/asoc/codecs/bolero/rx-macro.c
@@ -350,6 +350,7 @@ struct rx_macro_bcl_pmic_params {
u8 ppid;
};
+static int rx_macro_core_vote(void *handle, bool enable);
static int rx_macro_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai);
@@ -1230,10 +1231,12 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
if (rx_priv->rx_mclk_users == 0) {
if (rx_priv->is_native_on)
rx_priv->clk_id = RX_CORE_CLK;
+ rx_macro_core_vote(rx_priv, true);
ret = bolero_clk_rsc_request_clock(rx_priv->dev,
rx_priv->default_clk_id,
rx_priv->clk_id,
true);
+ rx_macro_core_vote(rx_priv, false);
if (ret < 0) {
dev_err(rx_priv->dev,
"%s: rx request clock enable failed\n",
@@ -1283,10 +1286,12 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
0x01, 0x00);
bolero_clk_rsc_fs_gen_request(rx_priv->dev,
false);
+ rx_macro_core_vote(rx_priv, true);
bolero_clk_rsc_request_clock(rx_priv->dev,
rx_priv->default_clk_id,
rx_priv->clk_id,
false);
+ rx_macro_core_vote(rx_priv, false);
rx_priv->clk_id = rx_priv->default_clk_id;
}
}
@@ -1396,18 +1401,21 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
}
break;
case BOLERO_MACRO_EVT_PRE_SSR_UP:
+ rx_macro_core_vote(rx_priv, true);
/* enable&disable RX_CORE_CLK to reset GFMUX reg */
ret = bolero_clk_rsc_request_clock(rx_priv->dev,
rx_priv->default_clk_id,
RX_CORE_CLK, true);
- if (ret < 0)
+ if (ret < 0) {
dev_err_ratelimited(rx_priv->dev,
"%s, failed to enable clk, ret:%d\n",
__func__, ret);
- else
+ } else {
bolero_clk_rsc_request_clock(rx_priv->dev,
rx_priv->default_clk_id,
RX_CORE_CLK, false);
+ }
+ rx_macro_core_vote(rx_priv, false);
break;
case BOLERO_MACRO_EVT_SSR_UP:
trace_printk("%s, enter SSR up\n", __func__);
@@ -3672,22 +3680,25 @@ static const struct snd_soc_dapm_route rx_audio_map[] = {
static int rx_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct rx_macro_priv *rx_priv = (struct rx_macro_priv *) handle;
if (rx_priv == NULL) {
pr_err("%s: rx priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(rx_priv->dev);
+ if (bolero_check_core_votes(rx_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(rx_priv->dev);
pm_runtime_mark_last_busy(rx_priv->dev);
}
-
- if (bolero_check_core_votes(rx_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int rx_swrm_clock(void *handle, bool enable)
@@ -4165,12 +4176,12 @@ static int rx_macro_probe(struct platform_device *pdev)
"%s: register macro failed\n", __func__);
goto err_reg_macro;
}
- schedule_work(&rx_priv->rx_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);
pm_suspend_ignore_children(&pdev->dev, true);
pm_runtime_enable(&pdev->dev);
+ schedule_work(&rx_priv->rx_macro_add_child_devices_work);
return 0;
diff --git a/asoc/codecs/bolero/tx-macro.c b/asoc/codecs/bolero/tx-macro.c
index 713357e9..2c95a62d 100644
--- a/asoc/codecs/bolero/tx-macro.c
+++ b/asoc/codecs/bolero/tx-macro.c
@@ -2678,22 +2678,25 @@ static int tx_macro_clk_switch(struct snd_soc_component *component, int clk_src)
static int tx_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle;
if (tx_priv == NULL) {
pr_err("%s: tx priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(tx_priv->dev);
+ if (bolero_check_core_votes(tx_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(tx_priv->dev);
pm_runtime_mark_last_busy(tx_priv->dev);
}
-
- if (bolero_check_core_votes(tx_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int tx_macro_swrm_clock(void *handle, bool enable)
@@ -3280,13 +3283,13 @@ static int tx_macro_probe(struct platform_device *pdev)
"%s: register macro failed\n", __func__);
goto err_reg_macro;
}
- 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);
pm_suspend_ignore_children(&pdev->dev, true);
pm_runtime_enable(&pdev->dev);
+ if (is_used_tx_swr_gpio)
+ schedule_work(&tx_priv->tx_macro_add_child_devices_work);
return 0;
err_reg_macro:
diff --git a/asoc/codecs/bolero/va-macro.c b/asoc/codecs/bolero/va-macro.c
index 79515882..1133d573 100644
--- a/asoc/codecs/bolero/va-macro.c
+++ b/asoc/codecs/bolero/va-macro.c
@@ -671,22 +671,25 @@ done:
static int va_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct va_macro_priv *va_priv = (struct va_macro_priv *) handle;
if (va_priv == NULL) {
pr_err("%s: va priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(va_priv->dev);
+ if (bolero_check_core_votes(va_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(va_priv->dev);
pm_runtime_mark_last_busy(va_priv->dev);
}
-
- if (bolero_check_core_votes(va_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int va_macro_swrm_clock(void *handle, bool enable)
@@ -3142,13 +3145,13 @@ static int va_macro_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s: register macro failed\n", __func__);
goto reg_macro_fail;
}
- if (is_used_va_swr_gpio)
- schedule_work(&va_priv->va_macro_add_child_devices_work);
pm_runtime_set_autosuspend_delay(&pdev->dev, VA_AUTO_SUSPEND_DELAY);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_suspend_ignore_children(&pdev->dev, true);
pm_runtime_enable(&pdev->dev);
+ if (is_used_va_swr_gpio)
+ schedule_work(&va_priv->va_macro_add_child_devices_work);
return ret;
reg_macro_fail:
diff --git a/asoc/codecs/bolero/wsa-macro.c b/asoc/codecs/bolero/wsa-macro.c
index 5ace96db..4e06d12b 100644
--- a/asoc/codecs/bolero/wsa-macro.c
+++ b/asoc/codecs/bolero/wsa-macro.c
@@ -2828,22 +2828,25 @@ static void wsa_macro_init_reg(struct snd_soc_component *component)
static int wsa_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle;
if (wsa_priv == NULL) {
pr_err("%s: wsa priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(wsa_priv->dev);
+ if (bolero_check_core_votes(wsa_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(wsa_priv->dev);
pm_runtime_mark_last_busy(wsa_priv->dev);
}
-
- if (bolero_check_core_votes(wsa_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int wsa_swrm_clock(void *handle, bool enable)
@@ -3237,12 +3240,12 @@ static int wsa_macro_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s: register macro failed\n", __func__);
goto reg_macro_fail;
}
- schedule_work(&wsa_priv->wsa_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);
pm_suspend_ignore_children(&pdev->dev, true);
pm_runtime_enable(&pdev->dev);
+ schedule_work(&wsa_priv->wsa_macro_add_child_devices_work);
return ret;
reg_macro_fail:
diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c
index 05650130..a704b570 100644
--- a/asoc/msm-pcm-routing-v2.c
+++ b/asoc/msm-pcm-routing-v2.c
@@ -1731,6 +1731,11 @@ static int msm_pcm_routing_channel_mixer(int fe_id, bool perf_mode,
for (i = 0; i < ADM_MAX_CHANNELS && channel_input[fe_id][i] > 0;
++i) {
be_id = channel_input[fe_id][i] - 1;
+ if (be_id < 0 || be_id >= MSM_BACKEND_DAI_MAX) {
+ pr_err("%s: Received out of bounds be_id %d\n",
+ __func__, be_id);
+ return -EINVAL;
+ }
channel_mixer[fe_id].input_channels[i] =
msm_bedais[be_id].channel;
@@ -3526,10 +3531,10 @@ static int msm_pcm_get_out_chs(struct snd_kcontrol *kcontrol,
static int msm_pcm_put_out_chs(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- u16 fe_id = 0;
-
+ u16 fe_id = 0, out_ch = 0;
fe_id = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
+ out_ch = ucontrol->value.integer.value[0];
if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
pr_err("%s: invalid FE %d\n", __func__, fe_id);
return -EINVAL;
@@ -3538,6 +3543,12 @@ static int msm_pcm_put_out_chs(struct snd_kcontrol *kcontrol,
pr_debug("%s: fe_id is %d, output channels = %d\n", __func__,
fe_id,
(unsigned int)(ucontrol->value.integer.value[0]));
+ if (out_ch < 0 ||
+ out_ch > ADM_MAX_CHANNELS) {
+ pr_err("%s: invalid output channel %d\n", __func__,
+ out_ch);
+ return -EINVAL;
+ }
channel_mixer[fe_id].output_channel =
(unsigned int)(ucontrol->value.integer.value[0]);