Skip to content

Commit

Permalink
Merge tag 'LA.UM.10.2.1.r1-03700-sdm660.0' of https://git.codelinaro.…
Browse files Browse the repository at this point in the history
…org/clo/la/platform/vendor/opensource/audio-kernel into 11-qtih

"LA.UM.10.2.1.r1-03700-sdm660.0"
  • Loading branch information
Anush02198 committed Oct 4, 2022
2 parents ac11877 + a13a32c commit 9ee8150
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 37 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 @@ -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)
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 @@ -2830,22 +2830,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
12 changes: 8 additions & 4 deletions techpack/audio/asoc/codecs/wcd937x/wcd937x.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMU:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
hph_mode == CLS_H_ULP)
((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)
Expand Down Expand Up @@ -506,7 +507,8 @@ static int wcd937x_codec_hphl_dac_event(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMD:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
hph_mode == CLS_H_ULP)
((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,
Expand Down Expand Up @@ -544,7 +546,8 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMU:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
hph_mode == CLS_H_ULP)
((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)
Expand Down Expand Up @@ -590,7 +593,8 @@ static int wcd937x_codec_hphr_dac_event(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMD:
if ((snd_soc_component_read32(component,
WCD937X_DIGITAL_EFUSE_REG_16) == 0x02) &&
hph_mode == CLS_H_ULP)
((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,
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
45 changes: 38 additions & 7 deletions techpack/audio/soc/swr-mstr-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static int swrm_get_ssp_period(struct swr_mstr_ctrl *swrm,
return ((swrm->bus_clk * 2) / ((row * col) * frame_sync));
}

static int swrm_core_vote_request(struct swr_mstr_ctrl *swrm)
static int swrm_core_vote_request(struct swr_mstr_ctrl *swrm, bool enable)
{
int ret = 0;

Expand All @@ -470,7 +470,7 @@ static int swrm_core_vote_request(struct swr_mstr_ctrl *swrm)
goto exit;
}
if (swrm->core_vote) {
ret = swrm->core_vote(swrm->handle, true);
ret = swrm->core_vote(swrm->handle, enable);
if (ret)
dev_err_ratelimited(swrm->dev,
"%s: core vote request failed\n", __func__);
Expand Down Expand Up @@ -501,8 +501,10 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
dev_err_ratelimited(swrm->dev,
"%s: core vote request failed\n",
__func__);
swrm->core_vote(swrm->handle, false);
goto exit;
}
ret = swrm->core_vote(swrm->handle, false);
}
}
swrm->clk_ref_count++;
Expand Down Expand Up @@ -538,6 +540,7 @@ static int swrm_ahb_write(struct swr_mstr_ctrl *swrm,
{
u32 temp = (u32)(*value);
int ret = 0;
int vote_ret = 0;

mutex_lock(&swrm->devlock);
if (!swrm->dev_up)
Expand All @@ -551,13 +554,20 @@ static int swrm_ahb_write(struct swr_mstr_ctrl *swrm,
__func__);
goto err;
}
} else if (swrm_core_vote_request(swrm)) {
goto err;
} else {
vote_ret = swrm_core_vote_request(swrm, true);
if (vote_ret == -ENOTSYNC)
goto err_vote;
else if (vote_ret)
goto err;
}

iowrite32(temp, swrm->swrm_dig_base + reg);
if (is_swr_clk_needed(swrm))
swrm_clk_request(swrm, FALSE);
err_vote:
if (!is_swr_clk_needed(swrm))
swrm_core_vote_request(swrm, false);
err:
mutex_unlock(&swrm->devlock);
return ret;
Expand All @@ -568,6 +578,7 @@ static int swrm_ahb_read(struct swr_mstr_ctrl *swrm,
{
u32 temp = 0;
int ret = 0;
int vote_ret = 0;

mutex_lock(&swrm->devlock);
if (!swrm->dev_up)
Expand All @@ -580,14 +591,21 @@ static int swrm_ahb_read(struct swr_mstr_ctrl *swrm,
__func__);
goto err;
}
} else if (swrm_core_vote_request(swrm)) {
goto err;
} else {
vote_ret = swrm_core_vote_request(swrm, true);
if (vote_ret == -ENOTSYNC)
goto err_vote;
else if (vote_ret)
goto err;
}

temp = ioread32(swrm->swrm_dig_base + reg);
*value = temp;
if (is_swr_clk_needed(swrm))
swrm_clk_request(swrm, FALSE);
err_vote:
if (!is_swr_clk_needed(swrm))
swrm_core_vote_request(swrm, false);
err:
mutex_unlock(&swrm->devlock);
return ret;
Expand Down Expand Up @@ -2583,6 +2601,7 @@ static int swrm_probe(struct platform_device *pdev)
int ret = 0;
struct clk *lpass_core_hw_vote = NULL;
struct clk *lpass_core_audio = NULL;
u32 swrm_hw_ver = 0;

/* Allocate soundwire master driver structure */
swrm = devm_kzalloc(&pdev->dev, sizeof(struct swr_mstr_ctrl),
Expand All @@ -2609,6 +2628,14 @@ static int swrm_probe(struct platform_device *pdev)
ret = -EINVAL;
goto err_pdata_fail;
}
ret = of_property_read_u32(pdev->dev.of_node,
"qcom,swr-master-version",
&swrm->version);
if (ret) {
dev_dbg(&pdev->dev, "%s: swrm version not defined, use default\n",
__func__);
swrm->version = SWRM_VERSION_1_6;
}
ret = of_property_read_u32(pdev->dev.of_node, "qcom,swr_master_id",
&swrm->master_id);
if (ret) {
Expand Down Expand Up @@ -2854,7 +2881,11 @@ static int swrm_probe(struct platform_device *pdev)
swr_master_add_boarddevices(&swrm->master);
mutex_lock(&swrm->mlock);
swrm_clk_request(swrm, true);
swrm->version = swr_master_read(swrm, SWRM_COMP_HW_VERSION);
swrm_hw_ver = swr_master_read(swrm, SWRM_COMP_HW_VERSION);
if (swrm->version != swrm_hw_ver)
dev_info(&pdev->dev,
"%s: version specified in dtsi: 0x%x not match with HW read version 0x%x\n",
__func__, swrm->version, swrm_hw_ver);
swrm->rd_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
& SWRM_COMP_PARAMS_RD_FIFO_DEPTH) >> 15);
swrm->wr_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
Expand Down

0 comments on commit 9ee8150

Please sign in to comment.