Skip to content

Commit

Permalink
Merge tag 'LA.UM.9.15.r1-06000-KAMORTA.QSSI13.0' of https://git.codel…
Browse files Browse the repository at this point in the history
…inaro.org/clo/la/platform/vendor/opensource/audio-kernel into main

"LA.UM.9.15.r1-06000-KAMORTA.QSSI13.0"

* tag 'LA.UM.9.15.r1-06000-KAMORTA.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
  asoc: notify dp driver after disp codec probe
  asoc: codecs: fix race condition of core vote and reg access
  ASoC: wcd937x: Add check for ULP irrespective of the Class
  asoc: codecs: Add nullptr check
  ASoC: wcd937x: Update QCRG sequence for wcd937x
  asoc: changes to fix KW errors.

Signed-off-by: Carlos Jimenez (JavaShin-X) <[email protected]>
  • Loading branch information
javashin committed Jun 16, 2022
2 parents f5a1e79 + d054ad8 commit 82400c4
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 34 deletions.
17 changes: 11 additions & 6 deletions techpack/audio/asoc/codecs/bolero/rx-macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
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",
Expand Down Expand Up @@ -1290,6 +1291,7 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
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;
}
}
Expand Down Expand Up @@ -1409,11 +1411,11 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
"%s, failed to enable clk, ret:%d\n",
__func__, ret);
} else {
rx_macro_core_vote(rx_priv, true);
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__);
Expand Down Expand Up @@ -3678,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)
Expand Down
13 changes: 8 additions & 5 deletions techpack/audio/asoc/codecs/bolero/tx-macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -2715,22 +2715,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)
Expand Down
13 changes: 8 additions & 5 deletions techpack/audio/asoc/codecs/bolero/va-macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,22 +672,25 @@ static int va_macro_tx_va_mclk_enable(struct va_macro_priv *va_priv,

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)
Expand Down
13 changes: 8 additions & 5 deletions techpack/audio/asoc/codecs/bolero/wsa-macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 29 additions & 0 deletions techpack/audio/asoc/codecs/msm_hdmi_codec_rx.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,10 @@ static int msm_ext_disp_audio_codec_rx_probe(
{
struct msm_ext_disp_audio_codec_rx_data *codec_data;
struct device_node *of_node_parent = NULL;
struct msm_ext_disp_codec_id codec_info;
int dai_id = DP_DAI1;
int type;
int rc = 0;

codec_data = kzalloc(sizeof(struct msm_ext_disp_audio_codec_rx_data),
GFP_KERNEL);
Expand Down Expand Up @@ -775,6 +779,31 @@ static int msm_ext_disp_audio_codec_rx_probe(
dev_dbg(component->dev, "%s(): registered %s with ext disp core\n",
__func__, component->name);

mutex_lock(&codec_data->dp_ops_lock);

/*Find a connected ext device to notify DisPlay*/
for (dai_id = DP_DAI1; dai_id < DP_DAI_MAX; dai_id++)
{
if (dai_id == HDMI_MS_DAI)
type = EXT_DISPLAY_TYPE_HDMI;
else
type = EXT_DISPLAY_TYPE_DP;

SWITCH_DP_CODEC(codec_info, codec_data, dai_id, type);

rc = msm_ext_disp_select_audio_codec(codec_data->ext_disp_core_pdev,
&codec_info);
if (!rc) {
if(codec_data->ext_disp_ops.ready) {
rc = codec_data->ext_disp_ops.ready(codec_data->ext_disp_core_pdev);
if(!rc)
break;
}
}
}

mutex_unlock(&codec_data->dp_ops_lock);

return 0;
}

Expand Down
26 changes: 25 additions & 1 deletion techpack/audio/asoc/codecs/wcd937x/wcd937x.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int wcd937x_init_reg(struct snd_soc_component *component)
snd_soc_component_update_bits(component,
WCD937X_BIAS_VBG_FINE_ADJ, 0xF0, 0xB0);
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90);
WCD937X_HPH_NEW_INT_RDAC_GAIN_CTL , 0xF0, 0x50);
}
return 0;
}
Expand Down Expand Up @@ -459,6 +459,12 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
set_bit(HPH_COMP_DELAY, &wcd937x->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90);
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
Expand Down Expand Up @@ -500,6 +506,12 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x80);
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_L,
0x0F, 0x01);
Expand Down Expand Up @@ -533,6 +545,12 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
set_bit(HPH_COMP_DELAY, &wcd937x->status_mask);
break;
case SND_SOC_DAPM_POST_PMU:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x90);
if (hph_mode == CLS_AB_HIFI || hph_mode == CLS_H_HIFI)
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
Expand Down Expand Up @@ -574,6 +592,12 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
WCD937X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x00);
break;
case SND_SOC_DAPM_POST_PMD:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
((snd_soc_component_read32(component,
WCD937X_ANA_HPH) & 0x0C) == 0x0C))
snd_soc_component_update_bits(component,
WCD937X_RX_BIAS_HPH_LOWPOWER, 0xF0, 0x80);
snd_soc_component_update_bits(component,
WCD937X_HPH_NEW_INT_RDAC_HD2_CTL_R,
0x0F, 0x01);
Expand Down
13 changes: 8 additions & 5 deletions techpack/audio/soc/pinctrl-lpi.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/

#include <linux/gpio.h>
Expand Down Expand Up @@ -261,12 +262,14 @@ static int lpi_gpio_set_mux(struct pinctrl_dev *pctldev, unsigned int function,

pad = pctldev->desc->pins[pin].drv_data;

pad->function = function;
if (pad != NULL) {
pad->function = function;

val = lpi_gpio_read(pad, LPI_GPIO_REG_VAL_CTL);
val &= ~(LPI_GPIO_REG_FUNCTION_MASK);
val |= pad->function << LPI_GPIO_REG_FUNCTION_SHIFT;
lpi_gpio_write(pad, LPI_GPIO_REG_VAL_CTL, val);
val = lpi_gpio_read(pad, LPI_GPIO_REG_VAL_CTL);
val &= ~(LPI_GPIO_REG_FUNCTION_MASK);
val |= pad->function << LPI_GPIO_REG_FUNCTION_SHIFT;
lpi_gpio_write(pad, LPI_GPIO_REG_VAL_CTL, val);
}
return 0;
}

Expand Down
Loading

0 comments on commit 82400c4

Please sign in to comment.