mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
Merge tag 'LA.UM.9.14.r1-20500.01-LAHAINA.QSSI12.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel into android12-5.4-lahaina
"LA.UM.9.14.r1-20500.01-LAHAINA.QSSI12.0" * tag 'LA.UM.9.14.r1-20500.01-LAHAINA.QSSI12.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel: asoc: add more return when msm_audio_ion_alloc failed audio-kernel: Do SRC with MFC dsp: dyn mclk support enable/disable in afe_set_lpass_clock_v2 asoc: ignore afe resp status to avoid 2s timeout asoc: enables paired rx port to address tdm slot shift issue dsp: functions for paired rx port enable/disable usecases asoc: change HS_IF dummy to playback audio-kernel: Reset client info on deregister. audio-routing: Support Rx to Tx loopback asoc: fixing incorrect log messages kernel: add place_marker for sound card register asoc: SEC CLK enable ASoC : Add new kcontrol for starting ASRC soc: swr-mstr-ctrl: Fix swr overflow for wsa audio-kernel: Disable clock voting logs asoc: 24 and 32bit format support for ASM loopback and playback config: remove unused conf for arauto audio-kernal: Loading only Gen3 specific mixer controls for Gen3 boards kernel: add place_marker for sound card register kernel: Add notifier for SSR asoc: kona: check if codec is enabled asoc: kona: Add wsa8815 codec and wsa883x codec init Asoc: check for invalid voice session id asoc: update port config for kona. config: Enable digital codec resource manager config asoc: auto: send effect config based on apptype asoc: Update dai link for wsa codec dai. asoc: codecs: Add nullptr check Audio-kernel: Comparison of unsigned value asoc : AFE Limiter module control soc: wsa881x: move analog init complete flag Change-Id: I566e3efbcd6a900e303bb89fb116e73c8de08bcf
This commit is contained in:
commit
d379f686be
34 changed files with 4361 additions and 2686 deletions
|
|
@ -76,8 +76,6 @@ static int audio_ext_clk_prepare(struct clk_hw *hw)
|
|||
if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
|
||||
(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX)) {
|
||||
clk_priv->clk_cfg.enable = 1;
|
||||
trace_printk("%s: vote for %d clock\n",
|
||||
__func__, clk_priv->clk_src);
|
||||
ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
|
||||
if (ret < 0) {
|
||||
if (__ratelimit(&rtl))
|
||||
|
|
@ -122,8 +120,6 @@ static void audio_ext_clk_unprepare(struct clk_hw *hw)
|
|||
if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
|
||||
(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX)) {
|
||||
clk_priv->clk_cfg.enable = 0;
|
||||
trace_printk("%s: unvote for %d clock\n",
|
||||
__func__, clk_priv->clk_src);
|
||||
ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
|
||||
if (ret < 0) {
|
||||
if (__ratelimit(&rtl))
|
||||
|
|
@ -161,7 +157,7 @@ static int lpass_hw_vote_prepare(struct clk_hw *hw)
|
|||
static DEFINE_RATELIMIT_STATE(rtl, 1 * HZ, 1);
|
||||
|
||||
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_CORE_HW_VOTE) {
|
||||
trace_printk("%s: vote for %d clock\n",
|
||||
pr_debug("%s: vote for %d clock\n",
|
||||
__func__, clk_priv->clk_src);
|
||||
ret = afe_vote_lpass_core_hw(AFE_LPASS_CORE_HW_MACRO_BLOCK,
|
||||
"LPASS_HW_MACRO",
|
||||
|
|
@ -174,7 +170,7 @@ static int lpass_hw_vote_prepare(struct clk_hw *hw)
|
|||
}
|
||||
|
||||
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_AUDIO_HW_VOTE) {
|
||||
trace_printk("%s: vote for %d clock\n",
|
||||
pr_debug("%s: vote for %d clock\n",
|
||||
__func__, clk_priv->clk_src);
|
||||
ret = afe_vote_lpass_core_hw(AFE_LPASS_CORE_HW_DCODEC_BLOCK,
|
||||
"LPASS_HW_DCODEC",
|
||||
|
|
@ -196,7 +192,7 @@ static void lpass_hw_vote_unprepare(struct clk_hw *hw)
|
|||
int ret = 0;
|
||||
|
||||
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_CORE_HW_VOTE) {
|
||||
trace_printk("%s: unvote for %d clock\n",
|
||||
pr_debug("%s: unvote for %d clock\n",
|
||||
__func__, clk_priv->clk_src);
|
||||
ret = afe_unvote_lpass_core_hw(
|
||||
AFE_LPASS_CORE_HW_MACRO_BLOCK,
|
||||
|
|
@ -208,7 +204,7 @@ static void lpass_hw_vote_unprepare(struct clk_hw *hw)
|
|||
}
|
||||
|
||||
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_AUDIO_HW_VOTE) {
|
||||
trace_printk("%s: unvote for %d clock\n",
|
||||
pr_debug("%s: unvote for %d clock\n",
|
||||
__func__, clk_priv->clk_src);
|
||||
ret = afe_unvote_lpass_core_hw(
|
||||
AFE_LPASS_CORE_HW_DCODEC_BLOCK,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of_platform.h>
|
||||
|
|
@ -891,7 +892,7 @@ static int bolero_ssr_enable(struct device *dev, void *data)
|
|||
priv->component,
|
||||
BOLERO_MACRO_EVT_CLK_RESET, 0x0);
|
||||
}
|
||||
trace_printk("%s: clk count reset\n", __func__);
|
||||
pr_debug("%s: clk count reset\n", __func__);
|
||||
|
||||
if (priv->rsc_clk_cb)
|
||||
priv->rsc_clk_cb(priv->clk_dev, BOLERO_MACRO_EVT_SSR_GFMUX_UP);
|
||||
|
|
@ -914,7 +915,6 @@ static int bolero_ssr_enable(struct device *dev, void *data)
|
|||
/* Add a 100usec sleep to ensure last register write is done */
|
||||
usleep_range(100,110);
|
||||
bolero_clk_rsc_enable_all_clocks(priv->clk_dev, false);
|
||||
trace_printk("%s: regcache_sync done\n", __func__);
|
||||
/* call ssr event for supported macros */
|
||||
for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) {
|
||||
if (!priv->macro_params[macro_idx].event_handler)
|
||||
|
|
@ -923,7 +923,6 @@ static int bolero_ssr_enable(struct device *dev, void *data)
|
|||
priv->component,
|
||||
BOLERO_MACRO_EVT_SSR_UP, 0x0);
|
||||
}
|
||||
trace_printk("%s: SSR up events processed by all macros\n", __func__);
|
||||
bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_SSR_UP);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1469,8 +1468,6 @@ int bolero_runtime_resume(struct device *dev)
|
|||
}
|
||||
}
|
||||
priv->core_hw_vote_count++;
|
||||
trace_printk("%s: hw vote count %d\n",
|
||||
__func__, priv->core_hw_vote_count);
|
||||
|
||||
audio_vote:
|
||||
if (priv->lpass_audio_hw_vote == NULL) {
|
||||
|
|
@ -1488,8 +1485,6 @@ audio_vote:
|
|||
}
|
||||
}
|
||||
priv->core_audio_vote_count++;
|
||||
trace_printk("%s: audio vote count %d\n",
|
||||
__func__, priv->core_audio_vote_count);
|
||||
|
||||
done:
|
||||
mutex_unlock(&priv->vote_lock);
|
||||
|
|
@ -1513,7 +1508,7 @@ int bolero_runtime_suspend(struct device *dev)
|
|||
dev_dbg(dev, "%s: Invalid lpass core hw node\n",
|
||||
__func__);
|
||||
}
|
||||
trace_printk("%s: hw vote count %d\n",
|
||||
pr_debug("%s: hw vote count %d\n",
|
||||
__func__, priv->core_hw_vote_count);
|
||||
|
||||
if (priv->lpass_audio_hw_vote != NULL) {
|
||||
|
|
@ -1526,8 +1521,6 @@ int bolero_runtime_suspend(struct device *dev)
|
|||
dev_dbg(dev, "%s: Invalid lpass audio hw node\n",
|
||||
__func__);
|
||||
}
|
||||
trace_printk("%s: audio vote count %d\n",
|
||||
__func__, priv->core_audio_vote_count);
|
||||
|
||||
mutex_unlock(&priv->vote_lock);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/of_platform.h>
|
||||
|
|
@ -136,7 +137,6 @@ int bolero_rsc_clk_reset(struct device *dev, int clk_id)
|
|||
dev_dbg(priv->dev,
|
||||
"%s: clock reset after ssr, count %d\n", __func__, count);
|
||||
|
||||
trace_printk("%s: clock reset after ssr, count %d\n", __func__, count);
|
||||
while (count--) {
|
||||
clk_prepare_enable(priv->clk[clk_id]);
|
||||
clk_prepare_enable(priv->clk[clk_id + NPL_CLK_OFFSET]);
|
||||
|
|
@ -297,8 +297,6 @@ static int bolero_clk_rsc_mux1_clk_request(struct bolero_clk_rsc *priv,
|
|||
if (priv->dev_up_gfmux) {
|
||||
iowrite32(0x1, clk_muxsel);
|
||||
muxsel = ioread32(clk_muxsel);
|
||||
trace_printk("%s: muxsel value after enable: %d\n",
|
||||
__func__, muxsel);
|
||||
}
|
||||
bolero_clk_rsc_mux0_clk_request(priv,
|
||||
default_clk_id,
|
||||
|
|
@ -330,8 +328,6 @@ static int bolero_clk_rsc_mux1_clk_request(struct bolero_clk_rsc *priv,
|
|||
if (priv->dev_up_gfmux) {
|
||||
iowrite32(0x0, clk_muxsel);
|
||||
muxsel = ioread32(clk_muxsel);
|
||||
trace_printk("%s: muxsel value after disable: %d\n",
|
||||
__func__, muxsel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -555,7 +551,6 @@ int bolero_clk_rsc_request_clock(struct device *dev,
|
|||
if (!priv->dev_up && enable) {
|
||||
dev_err_ratelimited(priv->dev, "%s: SSR is in progress..\n",
|
||||
__func__);
|
||||
trace_printk("%s: SSR is in progress..\n", __func__);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -585,9 +580,6 @@ int bolero_clk_rsc_request_clock(struct device *dev,
|
|||
dev_dbg(priv->dev, "%s: clk_cnt: %d for requested clk: %d, enable: %d\n",
|
||||
__func__, priv->clk_cnt[clk_id_req], clk_id_req,
|
||||
enable);
|
||||
trace_printk("%s: clk_cnt: %d for requested clk: %d, enable: %d\n",
|
||||
__func__, priv->clk_cnt[clk_id_req], clk_id_req,
|
||||
enable);
|
||||
|
||||
mutex_unlock(&priv->rsc_clk_lock);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -1396,7 +1397,7 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
|
|||
}
|
||||
}
|
||||
exit:
|
||||
trace_printk("%s: mclk_enable = %u, dapm = %d clk_users= %d\n",
|
||||
dev_dbg(rx_priv->dev, "%s: mclk_enable = %u, dapm = %d clk_users= %d\n",
|
||||
__func__, mclk_enable, dapm, rx_priv->rx_mclk_users);
|
||||
mutex_unlock(&rx_priv->mclk_lock);
|
||||
return ret;
|
||||
|
|
@ -1483,7 +1484,6 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
|
|||
rx_macro_wcd_clsh_imped_config(component, data, false);
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
trace_printk("%s, enter SSR down\n", __func__);
|
||||
rx_priv->dev_up = false;
|
||||
if (rx_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
|
|
@ -1518,7 +1518,6 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
|
|||
rx_macro_core_vote(rx_priv, false);
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
trace_printk("%s, enter SSR up\n", __func__);
|
||||
rx_priv->dev_up = true;
|
||||
/* reset swr after ssr/pdr */
|
||||
rx_priv->reset_swr = true;
|
||||
|
|
@ -3827,8 +3826,6 @@ static int rx_swrm_clock(void *handle, bool enable)
|
|||
|
||||
mutex_lock(&rx_priv->swr_clk_lock);
|
||||
|
||||
trace_printk("%s: swrm clock %s\n",
|
||||
__func__, (enable ? "enable" : "disable"));
|
||||
dev_dbg(rx_priv->dev, "%s: swrm clock %s\n",
|
||||
__func__, (enable ? "enable" : "disable"));
|
||||
if (enable) {
|
||||
|
|
@ -3895,8 +3892,6 @@ static int rx_swrm_clock(void *handle, bool enable)
|
|||
}
|
||||
}
|
||||
}
|
||||
trace_printk("%s: swrm clock users %d\n",
|
||||
__func__, rx_priv->swr_clk_users);
|
||||
dev_dbg(rx_priv->dev, "%s: swrm clock users %d\n",
|
||||
__func__, rx_priv->swr_clk_users);
|
||||
exit:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -419,7 +420,6 @@ static int tx_macro_event_handler(struct snd_soc_component *component,
|
|||
|
||||
switch (event) {
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
trace_printk("%s, enter SSR down\n", __func__);
|
||||
if (tx_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
|
|
@ -436,7 +436,6 @@ static int tx_macro_event_handler(struct snd_soc_component *component,
|
|||
}
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
trace_printk("%s, enter SSR up\n", __func__);
|
||||
/* reset swr after ssr/pdr */
|
||||
tx_priv->reset_swr = true;
|
||||
if (tx_priv->swr_ctrl_data)
|
||||
|
|
@ -2632,9 +2631,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
|
|||
{
|
||||
int ret = 0, clk_tx_ret = 0;
|
||||
|
||||
trace_printk("%s: clock type %s, enable: %s tx_mclk_users: %d\n",
|
||||
__func__, (clk_type ? "VA_MCLK" : "TX_MCLK"),
|
||||
(enable ? "enable" : "disable"), tx_priv->tx_mclk_users);
|
||||
dev_dbg(tx_priv->dev,
|
||||
"%s: clock type %s, enable: %s tx_mclk_users: %d\n",
|
||||
__func__, (clk_type ? "VA_MCLK" : "TX_MCLK"),
|
||||
|
|
@ -2642,7 +2638,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
|
|||
|
||||
if (enable) {
|
||||
if (tx_priv->swr_clk_users == 0) {
|
||||
trace_printk("%s: tx swr clk users 0\n", __func__);
|
||||
ret = msm_cdc_pinctrl_select_active_state(
|
||||
tx_priv->tx_swr_gpio_p);
|
||||
if (ret < 0) {
|
||||
|
|
@ -2660,7 +2655,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
|
|||
TX_CORE_CLK,
|
||||
true);
|
||||
if (clk_type == TX_MCLK) {
|
||||
trace_printk("%s: requesting TX_MCLK\n", __func__);
|
||||
ret = tx_macro_mclk_enable(tx_priv, 1);
|
||||
if (ret < 0) {
|
||||
if (tx_priv->swr_clk_users == 0)
|
||||
|
|
@ -2673,7 +2667,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
|
|||
}
|
||||
}
|
||||
if (clk_type == VA_MCLK) {
|
||||
trace_printk("%s: requesting VA_MCLK\n", __func__);
|
||||
ret = bolero_clk_rsc_request_clock(tx_priv->dev,
|
||||
TX_CORE_CLK,
|
||||
VA_CORE_CLK,
|
||||
|
|
@ -2707,8 +2700,6 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv,
|
|||
if (tx_priv->swr_clk_users == 0) {
|
||||
dev_dbg(tx_priv->dev, "%s: reset_swr: %d\n",
|
||||
__func__, tx_priv->reset_swr);
|
||||
trace_printk("%s: reset_swr: %d\n",
|
||||
__func__, tx_priv->reset_swr);
|
||||
if (tx_priv->reset_swr)
|
||||
regmap_update_bits(regmap,
|
||||
BOLERO_CDC_TX_CLK_RST_CTRL_SWR_CONTROL,
|
||||
|
|
@ -2806,7 +2797,6 @@ done:
|
|||
TX_CORE_CLK,
|
||||
false);
|
||||
exit:
|
||||
trace_printk("%s: exit\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2920,10 +2910,6 @@ static int tx_macro_swrm_clock(void *handle, bool enable)
|
|||
}
|
||||
|
||||
mutex_lock(&tx_priv->swr_clk_lock);
|
||||
trace_printk("%s: swrm clock %s tx_swr_clk_cnt: %d va_swr_clk_cnt: %d\n",
|
||||
__func__,
|
||||
(enable ? "enable" : "disable"),
|
||||
tx_priv->tx_swr_clk_cnt, tx_priv->va_swr_clk_cnt);
|
||||
dev_dbg(tx_priv->dev,
|
||||
"%s: swrm clock %s tx_swr_clk_cnt: %d va_swr_clk_cnt: %d\n",
|
||||
__func__, (enable ? "enable" : "disable"),
|
||||
|
|
@ -2986,9 +2972,6 @@ static int tx_macro_swrm_clock(void *handle, bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
trace_printk("%s: swrm clock users %d tx_clk_sts_cnt: %d va_clk_sts_cnt: %d\n",
|
||||
__func__, tx_priv->swr_clk_users, tx_priv->tx_clk_status,
|
||||
tx_priv->va_clk_status);
|
||||
dev_dbg(tx_priv->dev,
|
||||
"%s: swrm clock users %d tx_clk_sts_cnt: %d va_clk_sts_cnt: %d\n",
|
||||
__func__, tx_priv->swr_clk_users, tx_priv->tx_clk_status,
|
||||
|
|
|
|||
|
|
@ -328,7 +328,6 @@ static int va_macro_event_handler(struct snd_soc_component *component,
|
|||
va_macro_core_vote(va_priv, false);
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
trace_printk("%s, enter SSR up\n", __func__);
|
||||
/* reset swr after ssr/pdr */
|
||||
va_priv->reset_swr = true;
|
||||
va_priv->dev_up = true;
|
||||
|
|
@ -341,7 +340,6 @@ static int va_macro_event_handler(struct snd_soc_component *component,
|
|||
bolero_rsc_clk_reset(va_dev, VA_CORE_CLK);
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
trace_printk("%s: BOLERO_MACRO_EVT_SSR_DOWN\n", __func__);
|
||||
va_priv->dev_up = false;
|
||||
if (va_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -1014,7 +1015,6 @@ static int wsa_macro_event_handler(struct snd_soc_component *component,
|
|||
|
||||
switch (event) {
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
trace_printk("%s, enter SSR down\n", __func__);
|
||||
if (wsa_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
|
|
@ -1047,7 +1047,6 @@ static int wsa_macro_event_handler(struct snd_soc_component *component,
|
|||
wsa_macro_core_vote(wsa_priv, false);
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
trace_printk("%s, enter SSR up\n", __func__);
|
||||
/* reset swr after ssr/pdr */
|
||||
wsa_priv->reset_swr = true;
|
||||
if (wsa_priv->swr_ctrl_data)
|
||||
|
|
@ -2930,9 +2929,6 @@ static int wsa_swrm_clock(void *handle, bool enable)
|
|||
|
||||
mutex_lock(&wsa_priv->swr_clk_lock);
|
||||
|
||||
trace_printk("%s: %s swrm clock %s\n",
|
||||
dev_name(wsa_priv->dev), __func__,
|
||||
(enable ? "enable" : "disable"));
|
||||
dev_dbg(wsa_priv->dev, "%s: swrm clock %s\n",
|
||||
__func__, (enable ? "enable" : "disable"));
|
||||
if (enable) {
|
||||
|
|
@ -2998,9 +2994,6 @@ static int wsa_swrm_clock(void *handle, bool enable)
|
|||
}
|
||||
}
|
||||
}
|
||||
trace_printk("%s: %s swrm clock users: %d\n",
|
||||
dev_name(wsa_priv->dev), __func__,
|
||||
wsa_priv->swr_clk_users);
|
||||
dev_dbg(wsa_priv->dev, "%s: swrm clock users %d\n",
|
||||
__func__, wsa_priv->swr_clk_users);
|
||||
exit:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
|
|
@ -655,7 +656,6 @@ static int swr_haptics_suspend(struct device *dev)
|
|||
dev_err(dev, "%s: no data for swr_hap\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
trace_printk("%s: suspended\n", __func__);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -670,7 +670,6 @@ static int swr_haptics_resume(struct device *dev)
|
|||
dev_err(dev, "%s: no data for swr_hap\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
trace_printk("%s: resumed\n", __func__);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1194,17 +1194,7 @@ static int wsa881x_probe(struct snd_soc_component *component)
|
|||
"client failed\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
mutex_init(&wsa_pdata[wsa881x_index].bg_lock);
|
||||
mutex_init(&wsa_pdata[wsa881x_index].res_lock);
|
||||
snprintf(wsa_pdata[wsa881x_index].tz_pdata.name, 100, "%s",
|
||||
wsa_tz_names[wsa881x_index]);
|
||||
wsa_pdata[wsa881x_index].component = component;
|
||||
wsa_pdata[wsa881x_index].spk_pa_gain = SPK_GAIN_12DB;
|
||||
wsa_pdata[wsa881x_index].component = component;
|
||||
wsa_pdata[wsa881x_index].tz_pdata.component = component;
|
||||
wsa_pdata[wsa881x_index].tz_pdata.wsa_temp_reg_read =
|
||||
wsa881x_temp_reg_read;
|
||||
snd_soc_component_set_drvdata(component, &wsa_pdata[wsa881x_index]);
|
||||
|
||||
while (retry) {
|
||||
if (wsa_pdata[wsa881x_index].regmap_flag)
|
||||
break;
|
||||
|
|
@ -1216,6 +1206,18 @@ static int wsa881x_probe(struct snd_soc_component *component)
|
|||
"analog slave not initilized\n", __func__);
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
mutex_init(&wsa_pdata[wsa881x_index].bg_lock);
|
||||
mutex_init(&wsa_pdata[wsa881x_index].res_lock);
|
||||
snprintf(wsa_pdata[wsa881x_index].tz_pdata.name, 100, "%s",
|
||||
wsa_tz_names[wsa881x_index]);
|
||||
wsa_pdata[wsa881x_index].component = component;
|
||||
wsa_pdata[wsa881x_index].spk_pa_gain = SPK_GAIN_12DB;
|
||||
wsa_pdata[wsa881x_index].component = component;
|
||||
wsa_pdata[wsa881x_index].tz_pdata.component = component;
|
||||
wsa_pdata[wsa881x_index].tz_pdata.wsa_temp_reg_read =
|
||||
wsa881x_temp_reg_read;
|
||||
snd_soc_component_set_drvdata(component, &wsa_pdata[wsa881x_index]);
|
||||
wsa881x_init_thermal(&wsa_pdata[wsa881x_index].tz_pdata);
|
||||
INIT_DELAYED_WORK(&wsa_pdata[wsa881x_index].ocp_ctl_work,
|
||||
wsa881x_ocp_ctl_work);
|
||||
|
|
|
|||
43
techpack/audio/asoc/gvm_auto_spf_dummy.c
Executable file → Normal file
43
techpack/audio/asoc/gvm_auto_spf_dummy.c
Executable file → Normal file
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
|
@ -29,6 +30,9 @@
|
|||
#include <sound/info.h>
|
||||
#include <dsp/audio_notifier.h>
|
||||
#include "msm_dailink.h"
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
#include <soc/qcom/subsystem_notif.h>
|
||||
#include <soc/qcom/boot_stats.h>
|
||||
|
||||
|
||||
#define DRV_NAME "spf-asoc-snd"
|
||||
|
|
@ -465,7 +469,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = {
|
|||
{
|
||||
.name = "HS_IF0_TDM_RX_0_DUMMY",
|
||||
.stream_name = "TDM-LPAIF_SDR-RX-PRIMARY",
|
||||
.dpcm_capture = 1,
|
||||
.dpcm_playback = 1,
|
||||
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||
SND_SOC_DPCM_TRIGGER_POST},
|
||||
.ignore_suspend = 1,
|
||||
|
|
@ -485,7 +489,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = {
|
|||
{
|
||||
.name = "HS_IF1_TDM_RX_0_DUMMY",
|
||||
.stream_name = "TDM-LPAIF_SDR-RX-SECONDARY",
|
||||
.dpcm_capture = 1,
|
||||
.dpcm_playback = 1,
|
||||
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||
SND_SOC_DPCM_TRIGGER_POST},
|
||||
.ignore_suspend = 1,
|
||||
|
|
@ -505,7 +509,7 @@ static struct snd_soc_dai_link msm_gvm8295_dai_links[] = {
|
|||
{
|
||||
.name = "HS_IF2_TDM_RX_0_DUMMY",
|
||||
.stream_name = "TDM-LPAIF_SDR-RX-TERTIARY",
|
||||
.dpcm_capture = 1,
|
||||
.dpcm_playback = 1,
|
||||
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||
SND_SOC_DPCM_TRIGGER_POST},
|
||||
.ignore_suspend = 1,
|
||||
|
|
@ -823,13 +827,38 @@ void msm_common_set_pdata(struct snd_soc_card *card,
|
|||
pdata->common_pdata = common_pdata;
|
||||
}
|
||||
|
||||
static int auto_spf_dummy_ssr_cb(struct notifier_block *this,
|
||||
unsigned long code,
|
||||
void *data)
|
||||
{
|
||||
struct snd_soc_card *card = platform_get_drvdata(spdev);
|
||||
|
||||
switch (code) {
|
||||
case SUBSYS_BEFORE_SHUTDOWN:
|
||||
snd_soc_card_change_online_state(card, 0); // change sndcard status to OFFLINE
|
||||
dev_info(&spdev->dev, "ssr restart, mark sndcard offline\n");
|
||||
break;
|
||||
case SUBSYS_AFTER_POWERUP:
|
||||
snd_soc_card_change_online_state(card, 1); // change sndcard status to ONLINE
|
||||
dev_info(&spdev->dev, "ssr complete, mark sndcard online\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct notifier_block auto_spf_dummy_ssr_notifier = {
|
||||
.notifier_call = auto_spf_dummy_ssr_cb,
|
||||
};
|
||||
|
||||
static int msm_asoc_machine_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_card *card;
|
||||
struct msm_asoc_mach_data *pdata;
|
||||
int ret;
|
||||
|
||||
|
||||
place_marker("M - DRIVER Audio Init");
|
||||
|
||||
if (!pdev->dev.of_node) {
|
||||
dev_err(&pdev->dev, "No platform supplied from device tree\n");
|
||||
|
|
@ -881,8 +910,14 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
|||
}
|
||||
dev_info(&pdev->dev, "Sound card %s registered\n", card->name);
|
||||
pr_err("Sound card %s registered\n", card->name);
|
||||
|
||||
place_marker("M - DRIVER Audio Ready");
|
||||
|
||||
spdev = pdev;
|
||||
|
||||
subsys_notif_register_notifier("adsp", &auto_spf_dummy_ssr_notifier);
|
||||
dev_info(&pdev->dev, "Audio driver register for SSR complete\n");
|
||||
|
||||
return 0;
|
||||
err:
|
||||
devm_kfree(&pdev->dev, pdata);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _KONA_PORT_CONFIG
|
||||
|
|
@ -15,56 +16,56 @@
|
|||
*/
|
||||
|
||||
static struct port_params wsa_frame_params_default[SWR_MSTR_PORT_LEN] = {
|
||||
{7, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{31, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{63, 12, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF},
|
||||
{7, 6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{31, 18, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{63, 13, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF},
|
||||
{15, 7, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{15, 10, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{7, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{31, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{63, 12, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{7, 6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{31, 18, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{63, 13, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{15, 7, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x00, 0x00},
|
||||
{15, 10, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x00, 0x00},
|
||||
};
|
||||
|
||||
static struct port_params rx_frame_params_default[SWR_MSTR_PORT_LEN] = {
|
||||
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1},
|
||||
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0},
|
||||
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0},
|
||||
{7, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
|
||||
{0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0},
|
||||
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1, 0x00, 0x00},
|
||||
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0, 0x00, 0x00},
|
||||
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0, 0x00, 0x00},
|
||||
{7, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00},
|
||||
{0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0x00, 0x00},
|
||||
};
|
||||
|
||||
static struct port_params rx_frame_params_dsd[SWR_MSTR_PORT_LEN] = {
|
||||
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1},
|
||||
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0},
|
||||
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0},
|
||||
{7, 9, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0},
|
||||
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 3, 0},
|
||||
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1, 0x00, 0x00},
|
||||
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0, 0x00, 0x00},
|
||||
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0, 0x00, 0x00},
|
||||
{7, 9, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0, 0x00, 0x00},
|
||||
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 3, 0, 0x00, 0x00},
|
||||
};
|
||||
|
||||
/* TX UC1: TX1: 1ch, TX2: 2chs, TX3: 1ch(MBHC) */
|
||||
static struct port_params tx_frame_params_default[SWR_MSTR_PORT_LEN] = {
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},/* PCM OUT */
|
||||
{1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}, /* TX1 */
|
||||
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1}, /* TX2 */
|
||||
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}, /* TX3 */
|
||||
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1}, /* TX4 */
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},/* PCM OUT */
|
||||
{1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX1 */
|
||||
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX2 */
|
||||
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */
|
||||
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX4 */
|
||||
};
|
||||
|
||||
/* TX UC1: TX1: 1ch, TX2: 2chs, TX3: 1ch(MBHC) */
|
||||
static struct port_params tx_frame_params_v2[SWR_MSTR_PORT_LEN] = {
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},/* PCM OUT */
|
||||
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1}, /* TX1 */
|
||||
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2}, /* TX2 */
|
||||
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}, /* TX3 */
|
||||
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2}, /* TX4 */
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},/* PCM OUT */
|
||||
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX1 */
|
||||
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2, 0x00, 0x00}, /* TX2 */
|
||||
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */
|
||||
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2, 0x00, 0x00}, /* TX4 */
|
||||
};
|
||||
|
||||
static struct port_params tx_frame_params_wcd937x[SWR_MSTR_PORT_LEN] = {
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
|
||||
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
|
||||
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
|
||||
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
|
||||
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00},
|
||||
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00},
|
||||
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00},
|
||||
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00},
|
||||
};
|
||||
|
||||
static struct swr_mstr_port_map sm_port_map[] = {
|
||||
|
|
|
|||
|
|
@ -897,6 +897,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(bt_sample_rate_tx, bt_sample_rate_tx_text);
|
|||
static SOC_ENUM_SINGLE_EXT_DECL(afe_loopback_tx_chs, afe_loopback_tx_ch_text);
|
||||
|
||||
static bool is_initial_boot;
|
||||
static bool is_wsa8810;
|
||||
static bool codec_reg_done;
|
||||
static struct snd_soc_aux_dev *msm_aux_dev;
|
||||
static struct snd_soc_codec_conf *msm_codec_conf;
|
||||
|
|
@ -5548,43 +5549,66 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||
unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
||||
struct snd_soc_component *component = NULL;
|
||||
struct snd_soc_dapm_context *dapm = NULL;
|
||||
struct snd_card *card = NULL;
|
||||
struct snd_info_entry *entry;
|
||||
struct msm_asoc_mach_data *pdata =
|
||||
snd_soc_card_get_drvdata(rtd->card);
|
||||
int wsa_active_devs = 0;
|
||||
|
||||
card = rtd->card->snd_card;
|
||||
if (!pdata->codec_root) {
|
||||
entry = msm_snd_info_create_subdir(card->module, "codecs",
|
||||
card->proc_root);
|
||||
if (!entry) {
|
||||
pr_debug("%s: Cannot create codecs module entry\n",
|
||||
__func__);
|
||||
return 0;
|
||||
}
|
||||
pdata->codec_root = entry;
|
||||
}
|
||||
|
||||
if (pdata->wsa_max_devs > 0) {
|
||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.1");
|
||||
if (!component)
|
||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.3");
|
||||
if (component) {
|
||||
dapm = snd_soc_component_get_dapm(component);
|
||||
|
||||
wsa881x_set_channel_map(component, &spkleft_ports[0],
|
||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||
&ch_rate[0], &spkleft_port_types[0]);
|
||||
if (strnstr(component->name, "wsa883x", sizeof(component->name))) {
|
||||
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||
&ch_rate[0], &spkleft_port_types[0]);
|
||||
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
component);
|
||||
} else if (strnstr(component->name, "wsa881x", sizeof(component->name))) {
|
||||
wsa881x_set_channel_map(component, &spkleft_ports[0],
|
||||
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
||||
&ch_rate[0], &spkleft_port_types[0]);
|
||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
component);
|
||||
}
|
||||
|
||||
if (dapm->component) {
|
||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
|
||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
|
||||
}
|
||||
/*
|
||||
* Send speaker configuration only for WSA8810.
|
||||
* Default configuration is for WSA8815.
|
||||
*/
|
||||
wsa_macro_set_spkr_mode(component,WSA_MACRO_SPKR_MODE_1);
|
||||
wsa_macro_set_spkr_gain_offset(component,WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
component);
|
||||
|
||||
if (!strcmp(component->name, WSA8810_NAME_1) ||
|
||||
!strcmp(component->name, WSA8810_NAME_2))
|
||||
is_wsa8810 = true;
|
||||
|
||||
wsa_active_devs++;
|
||||
} else {
|
||||
pr_info("%s: wsa-codec.1 component is NULL\n", __func__);
|
||||
pr_err("%s: wsa-codec.1 and wsa-codec.3 component are NULL\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
/* If current platform has more than one WSA */
|
||||
if (pdata->wsa_max_devs > wsa_active_devs) {
|
||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.2");
|
||||
if (!component)
|
||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.4");
|
||||
if (!component) {
|
||||
pr_err("%s: wsa-codec.2 component is NULL\n", __func__);
|
||||
pr_err("%s: %d WSA is found. Expect %d WSA.",
|
||||
__func__, wsa_active_devs, pdata->wsa_max_devs);
|
||||
return -EINVAL;
|
||||
|
|
@ -5592,16 +5616,24 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||
|
||||
dapm = snd_soc_component_get_dapm(component);
|
||||
|
||||
wsa881x_set_channel_map(component, &spkright_ports[0],
|
||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||
&ch_rate[0], &spkright_port_types[0]);
|
||||
if (strnstr(component->name, "wsa883x", sizeof(component->name))) {
|
||||
wsa883x_set_channel_map(component, &spkright_ports[0],
|
||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||
&ch_rate[0], &spkright_port_types[0]);
|
||||
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
component);
|
||||
} else if (strnstr(component->name, "wsa881x", sizeof(component->name))) {
|
||||
wsa881x_set_channel_map(component, &spkright_ports[0],
|
||||
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
||||
&ch_rate[0], &spkright_port_types[0]);
|
||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
component);
|
||||
}
|
||||
|
||||
if (dapm->component) {
|
||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
|
||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
|
||||
}
|
||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
component);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -5694,22 +5726,27 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
|
|||
* Send speaker configuration only for WSA8810.
|
||||
* Default configuration is for WSA8815.
|
||||
*/
|
||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.1");
|
||||
if (!component) {
|
||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.3");
|
||||
if (!component) {
|
||||
pr_debug("%s: wsa-codec.3 component is NULL\n",
|
||||
__func__);
|
||||
} else {
|
||||
wsa_macro_set_spkr_mode(bolero_component,WSA_MACRO_SPKR_MODE_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
wsa_macro_set_spkr_mode(bolero_component,WSA_MACRO_SPKR_MODE_1);
|
||||
wsa_macro_set_spkr_gain_offset(bolero_component,WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
||||
if (is_wsa8810) {
|
||||
wsa_macro_set_spkr_mode(bolero_component,
|
||||
WSA_MACRO_SPKR_MODE_1);
|
||||
wsa_macro_set_spkr_gain_offset(bolero_component,
|
||||
WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
||||
}
|
||||
|
||||
if (pdata->wcd_disabled) {
|
||||
codec_reg_done = true;
|
||||
if (pdata->lito_v2_enabled) {
|
||||
/*
|
||||
* Enable tx data line3 for saipan version v2 and
|
||||
* write corresponding lpi register.
|
||||
*/
|
||||
bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map_v2),
|
||||
|
||||
sm_port_map_v2);
|
||||
} else {
|
||||
bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map),
|
||||
sm_port_map);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -5759,10 +5796,10 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
|
|||
* Enable tx data line3 for saipan version v2 and
|
||||
* write corresponding lpi register.
|
||||
*/
|
||||
bolero_set_port_map(component, ARRAY_SIZE(sm_port_map_v2),
|
||||
bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map_v2),
|
||||
sm_port_map_v2);
|
||||
} else {
|
||||
bolero_set_port_map(component, ARRAY_SIZE(sm_port_map),
|
||||
bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map),
|
||||
sm_port_map);
|
||||
}
|
||||
}
|
||||
|
|
@ -7162,10 +7199,12 @@ static struct snd_soc_dai_link msm_kona_dai_links[
|
|||
static int msm_populate_dai_link_component_of_node(
|
||||
struct snd_soc_card *card)
|
||||
{
|
||||
int i, index, ret = 0;
|
||||
int i, j, index, ret = 0;
|
||||
struct device *cdev = card->dev;
|
||||
struct snd_soc_dai_link *dai_link = card->dai_link;
|
||||
struct device_node *np;
|
||||
int codecs_enabled = 0;
|
||||
struct snd_soc_dai_link_component *codecs_comp = NULL;
|
||||
|
||||
if (!cdev) {
|
||||
dev_err(cdev, "%s: Sound card device memory NULL\n", __func__);
|
||||
|
|
@ -7222,22 +7261,77 @@ static int msm_populate_dai_link_component_of_node(
|
|||
}
|
||||
|
||||
/* populate codec_of_node for snd card dai links */
|
||||
if (dai_link[i].codecs->name && !dai_link[i].codecs->of_node) {
|
||||
index = of_property_match_string(cdev->of_node,
|
||||
"asoc-codec-names",
|
||||
dai_link[i].codecs->name);
|
||||
if (index < 0)
|
||||
continue;
|
||||
np = of_parse_phandle(cdev->of_node, "asoc-codec",
|
||||
index);
|
||||
if (!np) {
|
||||
dev_err(cdev, "%s: retrieving phandle for codec %s failed\n",
|
||||
__func__, dai_link[i].codecs->name);
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
if (dai_link[i].num_codecs > 0) {
|
||||
for (j = 0; j < dai_link[i].num_codecs; j++) {
|
||||
if (dai_link[i].codecs[j].of_node ||
|
||||
!dai_link[i].codecs[j].name)
|
||||
continue;
|
||||
|
||||
index = of_property_match_string(cdev->of_node,
|
||||
"asoc-codec-names",
|
||||
dai_link[i].codecs[j].name);
|
||||
if (index < 0)
|
||||
continue;
|
||||
np = of_parse_phandle(cdev->of_node,
|
||||
"asoc-codec",
|
||||
index);
|
||||
if (!np) {
|
||||
dev_err(cdev, "%s: retrieving phandle for codec %s failed\n",
|
||||
__func__,
|
||||
dai_link[i].codecs[j].name);
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
dai_link[i].codecs[j].of_node = np;
|
||||
dai_link[i].codecs[j].name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* In multi-codec scenario, check if codecs are enabled for this platform */
|
||||
for (i = 0; i < card->num_links; i++) {
|
||||
codecs_enabled = 0;
|
||||
if (dai_link[i].num_codecs > 1) {
|
||||
for (j = 0; j < dai_link[i].num_codecs; j++) {
|
||||
if (!dai_link[i].codecs[j].of_node)
|
||||
continue;
|
||||
|
||||
np = dai_link[i].codecs[j].of_node;
|
||||
if (!of_device_is_available(np)) {
|
||||
dev_dbg(cdev, "%s: codec is disabled: %s\n",
|
||||
__func__,
|
||||
np->full_name);
|
||||
dai_link[i].codecs[j].of_node = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
codecs_enabled++;
|
||||
}
|
||||
if (codecs_enabled > 0 &&
|
||||
codecs_enabled < dai_link[i].num_codecs) {
|
||||
codecs_comp = devm_kzalloc(cdev,
|
||||
sizeof(struct snd_soc_dai_link_component)
|
||||
* codecs_enabled, GFP_KERNEL);
|
||||
if (!codecs_comp) {
|
||||
dev_err(cdev, "%s: %s dailink codec component alloc failed\n",
|
||||
__func__, dai_link[i].name);
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
index = 0;
|
||||
for (j = 0; j < dai_link[i].num_codecs; j++) {
|
||||
if(dai_link[i].codecs[j].of_node) {
|
||||
codecs_comp[index].of_node =
|
||||
dai_link[i].codecs[j].of_node;
|
||||
codecs_comp[index].dai_name =
|
||||
dai_link[i].codecs[j].dai_name;
|
||||
codecs_comp[index].name = NULL;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
dai_link[i].codecs = codecs_comp;
|
||||
dai_link[i].num_codecs = codecs_enabled;
|
||||
}
|
||||
dai_link[i].codecs->of_node = np;
|
||||
dai_link[i].codecs->name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
65
techpack/audio/asoc/msm-dai-q6-v2.c
Executable file → Normal file
65
techpack/audio/asoc/msm-dai-q6-v2.c
Executable file → Normal file
|
|
@ -494,6 +494,9 @@ static struct afe_param_id_tdm_lane_cfg tdm_lane_cfg = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
#define LIMITER_PARM_MAX 3
|
||||
static u16 limiter_param[LIMITER_PARM_MAX];
|
||||
|
||||
/* cache of group cfg per parent node */
|
||||
static struct afe_param_id_group_device_tdm_cfg tdm_group_cfg = {
|
||||
AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG,
|
||||
|
|
@ -544,6 +547,7 @@ struct afe_param_id_clock_set_v2_t global_dyn_mclk_cfg = {
|
|||
};
|
||||
|
||||
static int afe_dyn_clk_root_enum[] = {
|
||||
Q6AFE_LPASS_CLK_ROOT_DEFAULT,
|
||||
Q6AFE_LPASS_MCLK_IN0,
|
||||
Q6AFE_LPASS_MCLK_IN1,
|
||||
};
|
||||
|
|
@ -552,6 +556,7 @@ static int afe_dyn_clk_attri_enum[] = {
|
|||
Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
|
||||
Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND,
|
||||
Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR,
|
||||
Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO,
|
||||
};
|
||||
|
||||
static int afe_dyn_clk_id_enum[] = {
|
||||
|
|
@ -1652,7 +1657,6 @@ static int msm_dai_q6_power_mode_put(struct snd_kcontrol *kcontrol,
|
|||
u16 port_id = (u16)kcontrol->private_value;
|
||||
|
||||
pr_debug("%s: power mode = %d\n", __func__, value);
|
||||
trace_printk("%s: power mode = %d\n", __func__, value);
|
||||
|
||||
afe_set_power_mode_cfg(port_id, value);
|
||||
return 0;
|
||||
|
|
@ -1729,7 +1733,6 @@ static int msm_dai_q6_island_mode_put(struct snd_kcontrol *kcontrol,
|
|||
u16 port_id = (u16)kcontrol->private_value;
|
||||
|
||||
pr_debug("%s: island mode = %d\n", __func__, value);
|
||||
trace_printk("%s: island mode = %d\n", __func__, value);
|
||||
|
||||
afe_set_island_mode_cfg(port_id, value);
|
||||
return 0;
|
||||
|
|
@ -2857,7 +2860,7 @@ static int msm_dai_q6_cdc_hw_params(struct snd_pcm_hw_params *params,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u16 num_of_bits_set(u16 sd_line_mask)
|
||||
u16 num_of_bits_set(u16 sd_line_mask)
|
||||
{
|
||||
u8 num_bits_set = 0;
|
||||
|
||||
|
|
@ -2867,6 +2870,7 @@ static u16 num_of_bits_set(u16 sd_line_mask)
|
|||
}
|
||||
return num_bits_set;
|
||||
}
|
||||
EXPORT_SYMBOL(num_of_bits_set);
|
||||
|
||||
static int msm_dai_q6_i2s_hw_params(struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai, int stream)
|
||||
|
|
@ -10579,7 +10583,7 @@ static int msm_pcm_afe_limiter_param_ctl_info(struct snd_kcontrol *kcontrol,
|
|||
{
|
||||
ucontrol->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
||||
/* two int values: port_id and enable/disable */
|
||||
ucontrol->count = 2;
|
||||
ucontrol->count = LIMITER_PARM_MAX;
|
||||
/* Valid range is all positive values to support above controls */
|
||||
ucontrol->value.integer.min = 0;
|
||||
ucontrol->value.integer.max = INT_MAX;
|
||||
|
|
@ -10589,6 +10593,9 @@ static int msm_pcm_afe_limiter_param_ctl_info(struct snd_kcontrol *kcontrol,
|
|||
static int msm_pcm_afe_limiter_param_ctl_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
ucontrol->value.integer.value[0] = limiter_param[0];
|
||||
ucontrol->value.integer.value[1] = limiter_param[1];
|
||||
ucontrol->value.integer.value[2] = limiter_param[2];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -10600,17 +10607,30 @@ static int msm_pcm_afe_limiter_param_ctl_put(struct snd_kcontrol *kcontrol,
|
|||
struct param_hdr_v3 param_hdr;
|
||||
int ret = -EINVAL;
|
||||
|
||||
limiter_param[0] = ucontrol->value.integer.value[0];
|
||||
limiter_param[1] = ucontrol->value.integer.value[1];
|
||||
limiter_param[2] = ucontrol->value.integer.value[2];
|
||||
|
||||
|
||||
if(limiter_param[2] != LIMITER_PARM_MAX - 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_debug("%s: enter\n", __func__);
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
|
||||
port_id = ucontrol->value.integer.value[0];
|
||||
afe_limiter_disable.disable_afe_limiter = ucontrol->value.integer.value[1];
|
||||
port_id = limiter_param[0];
|
||||
afe_limiter_disable.disable_afe_limiter = limiter_param[1];
|
||||
|
||||
ret = afe_port_send_afe_limiter_param(port_id, &afe_limiter_disable);
|
||||
if (ret)
|
||||
pr_err("%s: AFE port logging setting for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
|
||||
//resetting number of parameters to zero
|
||||
limiter_param[2] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -11646,6 +11666,7 @@ static int msm_dai_q6_tdm_prepare(struct snd_pcm_substream *substream,
|
|||
u16 group_id = dai_data->group_cfg.tdm_cfg.group_id;
|
||||
int group_idx = 0;
|
||||
atomic_t *group_ref = NULL;
|
||||
int intf_idx = PORT_ID_TO_INTF_IDX(dai->id);
|
||||
|
||||
dev_dbg(dai->dev, "%s: dev_name: %s dev_id: 0x%x group_id: 0x%x\n",
|
||||
__func__, dev_name(dai->dev), dai->dev->id, group_id);
|
||||
|
|
@ -11666,7 +11687,6 @@ static int msm_dai_q6_tdm_prepare(struct snd_pcm_substream *substream,
|
|||
group_ref = &tdm_group_ref[group_idx];
|
||||
|
||||
if (!test_bit(STATUS_PORT_STARTED, dai_data->status_mask)) {
|
||||
|
||||
if (msm_dai_q6_get_tdm_clk_ref(group_idx) == 0) {
|
||||
/* TX and RX share the same clk. So enable the clk
|
||||
* per TDM interface. */
|
||||
|
|
@ -11678,7 +11698,18 @@ static int msm_dai_q6_tdm_prepare(struct snd_pcm_substream *substream,
|
|||
goto rtn;
|
||||
}
|
||||
}
|
||||
|
||||
/* Paired Rx Port Start */
|
||||
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
rc = afe_paired_rx_tdm_port_ops(intf_idx, true, tdm_group_ref);
|
||||
if (rc < 0) {
|
||||
pr_debug("%s:Paired Rx Port failed to start\n",__func__);
|
||||
if (msm_dai_q6_get_tdm_clk_ref(group_idx) == 0) {
|
||||
msm_dai_q6_tdm_set_clk(dai_data,
|
||||
dai->id, false);
|
||||
}
|
||||
goto rtn;
|
||||
}
|
||||
}
|
||||
/* PORT START should be set if prepare called
|
||||
* in active state.
|
||||
*/
|
||||
|
|
@ -11703,6 +11734,9 @@ static int msm_dai_q6_tdm_prepare(struct snd_pcm_substream *substream,
|
|||
rc = afe_tdm_port_start(dai->id, &dai_data->port_cfg,
|
||||
dai_data->rate, dai_data->num_group_ports);
|
||||
if (rc < 0) {
|
||||
rc = afe_paired_rx_tdm_port_ops(intf_idx, false, tdm_group_ref);
|
||||
if (rc < 0)
|
||||
pr_err("%s:Unable to close Paired Rx due to tx usecase start failure", __func__);
|
||||
if (atomic_read(group_ref) == 0) {
|
||||
afe_port_group_enable(group_id,
|
||||
NULL, false, NULL);
|
||||
|
|
@ -11717,6 +11751,7 @@ static int msm_dai_q6_tdm_prepare(struct snd_pcm_substream *substream,
|
|||
set_bit(STATUS_PORT_STARTED,
|
||||
dai_data->status_mask);
|
||||
atomic_inc(group_ref);
|
||||
pr_debug("%s: Group ref count: group_ref : %d", __func__, group_ref->counter);
|
||||
}
|
||||
|
||||
/* TODO: need to monitor PCM/MI2S/TDM HW status */
|
||||
|
|
@ -11738,6 +11773,7 @@ static void msm_dai_q6_tdm_shutdown(struct snd_pcm_substream *substream,
|
|||
u16 group_id = dai_data->group_cfg.tdm_cfg.group_id;
|
||||
int group_idx = 0;
|
||||
atomic_t *group_ref = NULL;
|
||||
int intf_idx = PORT_ID_TO_INTF_IDX(dai->id);
|
||||
|
||||
group_idx = msm_dai_q6_get_group_idx(dai->id);
|
||||
if (group_idx < 0) {
|
||||
|
|
@ -11757,6 +11793,7 @@ static void msm_dai_q6_tdm_shutdown(struct snd_pcm_substream *substream,
|
|||
__func__, dai->id);
|
||||
}
|
||||
atomic_dec(group_ref);
|
||||
pr_debug("%s: group_ref : %d \n",__func__, group_ref->counter);
|
||||
clear_bit(STATUS_PORT_STARTED,
|
||||
dai_data->status_mask);
|
||||
|
||||
|
|
@ -11768,7 +11805,17 @@ static void msm_dai_q6_tdm_shutdown(struct snd_pcm_substream *substream,
|
|||
__func__, group_id);
|
||||
}
|
||||
}
|
||||
|
||||
/* Paired Rx Stop */
|
||||
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
rc = afe_paired_rx_tdm_port_ops(intf_idx, false, tdm_group_ref);
|
||||
if (rc < 0){
|
||||
if (msm_dai_q6_get_tdm_clk_ref(group_idx) == 0) {
|
||||
msm_dai_q6_tdm_set_clk(dai_data,
|
||||
dai->id, false);
|
||||
}
|
||||
pr_err("%s:AFE Paired Rx Port Not disabled");
|
||||
}
|
||||
}
|
||||
if (msm_dai_q6_get_tdm_clk_ref(group_idx) == 0) {
|
||||
rc = msm_dai_q6_tdm_set_clk(dai_data,
|
||||
dai->id, false);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
/* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Add support for 24 and 32bit format for ASM loopback and playback session.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
|
|
@ -302,6 +305,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
|
|||
struct asm_session_mtmx_strtr_param_window_v2_t asm_mtmx_strtr_window;
|
||||
uint32_t param_id;
|
||||
struct msm_pcm_pdata *pdata;
|
||||
uint16_t format = 0;
|
||||
|
||||
if (!component) {
|
||||
pr_err("%s: component is NULL\n", __func__);
|
||||
|
|
@ -349,6 +353,23 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
|
|||
pcm->audio_client->fedai_id = rtd->dai_link->id;
|
||||
pcm->audio_client->perf_mode = pdata->perf_mode;
|
||||
pcm->audio_client->stream_type = substream->stream;
|
||||
|
||||
format = msm_pcm_asm_cfg_get(rtd->dai_link->id, MSM_ASM_LOOPBACK_MODE);
|
||||
switch (format) {
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
bits_per_sample = 32;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_LE:
|
||||
case SNDRV_PCM_FORMAT_S24_3LE:
|
||||
bits_per_sample = 24;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S16_LE:
|
||||
default:
|
||||
bits_per_sample = 16;
|
||||
}
|
||||
pr_debug("%s: fe_id:%d, bits_per_sample:%d\n",__func__,
|
||||
rtd->dai_link->id,bits_per_sample);
|
||||
|
||||
ret = q6asm_open_loopback_with_retry(pcm->audio_client,
|
||||
bits_per_sample);
|
||||
pcm->session_id = pcm->audio_client->session;
|
||||
|
|
@ -2062,8 +2083,7 @@ static int msm_loopback_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
|
|||
audio_client = q6asm_get_audio_client(fe_dai.strm_id);
|
||||
|
||||
event_data = (struct msm_adsp_event_data *)ucontrol->value.bytes.data;
|
||||
if ((event_data->event_type < ADSP_STREAM_PP_EVENT) ||
|
||||
(event_data->event_type >= ADSP_STREAM_EVENT_MAX)) {
|
||||
if (event_data->event_type >= ADSP_STREAM_EVENT_MAX) {
|
||||
pr_err("%s: invalid event_type=%d\n",
|
||||
__func__, event_data->event_type);
|
||||
ret = -EINVAL;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Add support for 24 and 32bit format for ASM loopback and playback session.
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/init.h>
|
||||
|
|
@ -273,19 +276,19 @@ static int msm_pcm_soft_volume_ctl_put(struct snd_kcontrol *kcontrol,
|
|||
|
||||
if ( prtd) {
|
||||
if ((ucontrol->value.integer.value[0] < 0) || (ucontrol->value.integer.value[0] > 15000)) {
|
||||
pr_err("%s : Ramp period range (0 to 15000), input value is out of range: %d",__func__,soft_params.period);
|
||||
pr_err("%s : Ramp period range (0 to 15000), input value is out of range: %d",__func__,ucontrol->value.integer.value[0]);
|
||||
goto exit;
|
||||
} else {
|
||||
soft_params.period = ucontrol->value.integer.value[0];
|
||||
}
|
||||
if ((ucontrol->value.integer.value[1] < 0) || (ucontrol->value.integer.value[1] > 15000000)) {
|
||||
pr_err("%s : Ramp step range (0 to 15000000), input value is out of range: %d",__func__,soft_params.step);
|
||||
pr_err("%s : Ramp step range (0 to 15000000), input value is out of range: %d",__func__,ucontrol->value.integer.value[1]);
|
||||
goto exit;
|
||||
} else {
|
||||
soft_params.step = ucontrol->value.integer.value[1];
|
||||
}
|
||||
if ((ucontrol->value.integer.value[2] < 0) || (ucontrol->value.integer.value[2] >= SOFT_VOLUME_CURVE_ENUM_MAX)) {
|
||||
pr_err("%s : Ramping curve range (0 to 2), input value is out of range: %d",__func__,soft_params.rampingcurve);
|
||||
pr_err("%s : Ramping curve range (0 to 2), input value is out of range: %d",__func__,ucontrol->value.integer.value[2]);
|
||||
goto exit;
|
||||
} else {
|
||||
soft_params.rampingcurve = ucontrol->value.integer.value[2];
|
||||
|
|
@ -557,6 +560,11 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
|
|||
uint32_t fmt_type = FORMAT_LINEAR_PCM;
|
||||
uint16_t bits_per_sample;
|
||||
uint16_t sample_word_size;
|
||||
uint16_t format_blk_bits_per_sample = 0;
|
||||
uint16_t format_blk_sample_word_size = 0;
|
||||
uint16_t format = 0;
|
||||
uint16_t req_format = 0;
|
||||
uint16_t input_file_format = 0;
|
||||
|
||||
if (!component) {
|
||||
pr_err("%s: component is NULL\n", __func__);
|
||||
|
|
@ -598,7 +606,21 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
|
|||
prtd->audio_client->stream_type = SNDRV_PCM_STREAM_PLAYBACK;
|
||||
prtd->audio_client->fedai_id = soc_prtd->dai_link->id;
|
||||
|
||||
switch (params_format(params)) {
|
||||
req_format = msm_pcm_asm_cfg_get(soc_prtd->dai_link->id, MSM_ASM_PLAYBACK_MODE);
|
||||
input_file_format = params_format(params);
|
||||
|
||||
pr_debug("%s: fe_id:%d, req_format:%d, input_file_format:%d\n",__func__,
|
||||
soc_prtd->dai_link->id, req_format, input_file_format);
|
||||
|
||||
if(req_format > input_file_format) {
|
||||
format = req_format;
|
||||
pr_debug("%s: enforce ASM bitwidth to %d from %d\n",__func__,
|
||||
format,input_file_format);
|
||||
}else {
|
||||
format = input_file_format;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
bits_per_sample = 32;
|
||||
sample_word_size = 32;
|
||||
|
|
@ -617,6 +639,10 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
|
|||
sample_word_size = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
pr_debug("%s: fe_id:%d, bits_per_sample:%d, sample_word_size:%d\n",__func__,
|
||||
soc_prtd->dai_link->id, bits_per_sample, sample_word_size);
|
||||
|
||||
if (prtd->compress_enable) {
|
||||
fmt_type = FORMAT_GEN_COMPR;
|
||||
pr_debug("%s: Compressed enabled!\n", __func__);
|
||||
|
|
@ -664,11 +690,32 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
|
|||
pr_err("%s: stream reg failed ret:%d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*Format block is configure with input file bits_per_sample*/
|
||||
switch (input_file_format) {
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
format_blk_bits_per_sample = 32;
|
||||
format_blk_sample_word_size = 32;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_LE:
|
||||
format_blk_bits_per_sample = 24;
|
||||
format_blk_sample_word_size = 32;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_3LE:
|
||||
format_blk_bits_per_sample = 24;
|
||||
format_blk_sample_word_size = 24;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S16_LE:
|
||||
default:
|
||||
format_blk_bits_per_sample = 16;
|
||||
format_blk_sample_word_size = 16;
|
||||
break;
|
||||
}
|
||||
if (prtd->compress_enable) {
|
||||
ret = q6asm_media_format_block_gen_compr(
|
||||
prtd->audio_client, runtime->rate,
|
||||
runtime->channels, !prtd->set_channel_map,
|
||||
prtd->channel_map, bits_per_sample);
|
||||
prtd->channel_map, format_blk_bits_per_sample);
|
||||
} else {
|
||||
|
||||
if ((q6core_get_avcs_api_version_per_service(
|
||||
|
|
@ -678,15 +725,15 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
|
|||
ret = q6asm_media_format_block_multi_ch_pcm_v5(
|
||||
prtd->audio_client, runtime->rate,
|
||||
runtime->channels, !chmap->set_channel_map,
|
||||
chmap->channel_map, bits_per_sample,
|
||||
sample_word_size, ASM_LITTLE_ENDIAN,
|
||||
chmap->channel_map, format_blk_bits_per_sample,
|
||||
format_blk_sample_word_size, ASM_LITTLE_ENDIAN,
|
||||
DEFAULT_QF);
|
||||
} else {
|
||||
ret = q6asm_media_format_block_multi_ch_pcm_v4(
|
||||
prtd->audio_client, runtime->rate,
|
||||
runtime->channels, !prtd->set_channel_map,
|
||||
prtd->channel_map, bits_per_sample,
|
||||
sample_word_size, ASM_LITTLE_ENDIAN,
|
||||
prtd->channel_map, format_blk_bits_per_sample,
|
||||
format_blk_sample_word_size, ASM_LITTLE_ENDIAN,
|
||||
DEFAULT_QF);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,9 @@
|
|||
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Add support for 24 and 32bit format for ASM loopback and playback session.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
|
|
@ -3052,6 +3055,11 @@ static void msm_pcm_routing_process_voice(u16 reg, u16 val, int set)
|
|||
pr_debug("%s: FE DAI 0x%x session_id 0x%x\n",
|
||||
__func__, val, session_id);
|
||||
|
||||
if (!session_id) {
|
||||
pr_err("%s: Invalid session_id %x\n", __func__, session_id);
|
||||
return;
|
||||
}
|
||||
|
||||
mutex_lock(&routing_lock);
|
||||
|
||||
if (set)
|
||||
|
|
@ -6342,6 +6350,294 @@ static int msm_routing_afe_lb_tx_port_put(struct snd_kcontrol *kcontrol,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define ASM_CFG_PARAM_MAX 4
|
||||
static int asm_cfg_params[ASM_CFG_PARAM_MAX];
|
||||
|
||||
struct msm_asm_config loopback_cfg[] = {
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA3] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA4] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA5] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA6] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA7] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA8] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA9] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA10] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA11] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA12] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA13] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA14] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA15] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA16] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA17] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA18] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA19] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA20] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA21] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA22] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA23] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA24] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA25] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA26] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA27] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA28] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA29] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA30] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA31] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA32] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA33] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA34] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOIP] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_AFE_RX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_AFE_TX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICE_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_DTMF_RX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_QCHAT] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOLTE_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM3] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM4] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM5] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM6] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM7] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM8] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICE2_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICEMMODE1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICEMMODE2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
};
|
||||
|
||||
struct msm_asm_config playback_cfg[] = {
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA3] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA4] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA5] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA6] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA7] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA8] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA9] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA10] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA11] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA12] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA13] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA14] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA15] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA16] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA17] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA18] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA19] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA20] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA21] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA22] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA23] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA24] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA25] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA26] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA27] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA28] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA29] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA30] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA31] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA32] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA33] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA34] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOIP] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_AFE_RX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_AFE_TX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICE_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_DTMF_RX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_QCHAT] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOLTE_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM3] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM4] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM5] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM6] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM7] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM8] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICE2_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICEMMODE1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICEMMODE2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
};
|
||||
|
||||
struct msm_asm_config capture_cfg[] = {
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA3] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA4] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA5] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA6] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA7] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA8] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA9] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA10] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA11] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA12] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA13] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA14] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA15] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA16] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA17] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA18] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA19] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA20] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA21] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA22] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA23] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA24] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA25] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA26] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA27] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA28] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA29] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA30] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA31] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA32] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA33] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_MULTIMEDIA34] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOIP] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_AFE_RX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_AFE_TX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICE_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_DTMF_RX] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_QCHAT] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOLTE_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM3] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM4] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM5] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM6] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM7] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_LSM8] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICE2_STUB] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICEMMODE1] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
[MSM_FRONTEND_DAI_VOICEMMODE2] = {0, 0, SNDRV_PCM_FORMAT_S16_LE},
|
||||
};
|
||||
|
||||
int msm_pcm_asm_cfg_get(int fe_id, int mode)
|
||||
{
|
||||
int format = 0;
|
||||
if (mode == MSM_ASM_PLAYBACK_MODE) {
|
||||
format = playback_cfg[fe_id].bit_format;
|
||||
}
|
||||
else if(mode == MSM_ASM_CAPTURE_MODE) {
|
||||
format = capture_cfg[fe_id].bit_format;
|
||||
}
|
||||
else if (mode == MSM_ASM_LOOPBACK_MODE) {
|
||||
format = loopback_cfg[fe_id].bit_format;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_pcm_asm_cfg_get);
|
||||
|
||||
static int msm_pcm_get_format(int value)
|
||||
{
|
||||
int format = 0;
|
||||
switch (value) {
|
||||
case 16:
|
||||
format = SNDRV_PCM_FORMAT_S16_LE;
|
||||
break;
|
||||
case 24:
|
||||
format = SNDRV_PCM_FORMAT_S24_LE;
|
||||
break;
|
||||
case 32:
|
||||
format = SNDRV_PCM_FORMAT_S32_LE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
static int msm_pcm_asm_format_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int ret = 0;
|
||||
int fe_id = 0, mode = 0, format = 0, set = 0;
|
||||
|
||||
mutex_lock(&routing_lock);
|
||||
asm_cfg_params[0] = ucontrol->value.integer.value[0];
|
||||
asm_cfg_params[1] = ucontrol->value.integer.value[1];
|
||||
asm_cfg_params[2] = ucontrol->value.integer.value[2];
|
||||
set = ucontrol->value.integer.value[3];
|
||||
mutex_unlock(&routing_lock);
|
||||
|
||||
if(set) {
|
||||
fe_id = asm_cfg_params[0];
|
||||
mode = asm_cfg_params[1];
|
||||
format = msm_pcm_get_format(asm_cfg_params[2]);
|
||||
|
||||
pr_debug("%s: fe_id:%d, mode:%d, format:%d, set:%d\n",
|
||||
__func__,fe_id,mode,format,set);
|
||||
|
||||
if((fe_id < MSM_FRONTEND_DAI_MULTIMEDIA1) ||
|
||||
(fe_id >= MSM_FRONTEND_DAI_MAX)) {
|
||||
pr_err("%s: Received invalid fe_id %lu\n", __func__, fe_id);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if((mode < MSM_ASM_PLAYBACK_MODE) ||
|
||||
(mode >= MSM_ASM_MAX_MODE)) {
|
||||
pr_err("%s: Received invalid mode %lu\n", __func__, mode);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if((format == SNDRV_PCM_FORMAT_S16_LE) ||
|
||||
(format == SNDRV_PCM_FORMAT_S24_LE) ||
|
||||
(format == SNDRV_PCM_FORMAT_S32_LE)) {
|
||||
if(mode == MSM_ASM_PLAYBACK_MODE) {
|
||||
playback_cfg[fe_id].fe_id = fe_id;
|
||||
playback_cfg[fe_id].mode = mode;
|
||||
playback_cfg[fe_id].bit_format = format;
|
||||
} else if(mode == MSM_ASM_CAPTURE_MODE) {
|
||||
capture_cfg[fe_id].fe_id = fe_id;
|
||||
capture_cfg[fe_id].mode = mode;
|
||||
capture_cfg[fe_id].bit_format = format;
|
||||
} else if(mode == MSM_ASM_LOOPBACK_MODE) {
|
||||
loopback_cfg[fe_id].fe_id = fe_id;
|
||||
loopback_cfg[fe_id].mode = mode;
|
||||
loopback_cfg[fe_id].bit_format = format;
|
||||
}
|
||||
}else {
|
||||
pr_err("%s: Received invalid foramt %lu\n", __func__,
|
||||
asm_cfg_params[2]);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_pcm_asm_format_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
mutex_lock(&routing_lock);
|
||||
ucontrol->value.integer.value[0] = asm_cfg_params[0];
|
||||
ucontrol->value.integer.value[1] = asm_cfg_params[1];
|
||||
ucontrol->value.integer.value[2] = asm_cfg_params[2];
|
||||
ucontrol->value.integer.value[3] = 0;
|
||||
mutex_unlock(&routing_lock);
|
||||
|
||||
pr_debug("%s: fe_id:%d, mode:%d, format:%d, set:%d\n",__func__,
|
||||
ucontrol->value.integer.value[0],
|
||||
ucontrol->value.integer.value[1],
|
||||
ucontrol->value.integer.value[2],
|
||||
ucontrol->value.integer.value[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_kcontrol_new msm_asm_format_controls[] = {
|
||||
SOC_SINGLE_MULTI_EXT("ASM Format", SND_SOC_NOPM,
|
||||
0, 0xFFFF, 0, 4,
|
||||
msm_pcm_asm_format_get,
|
||||
msm_pcm_asm_format_put),
|
||||
};
|
||||
|
||||
static const char *const ec_ref_rate_text[] = {"0", "8000", "16000",
|
||||
"24000", "32000", "44100", "48000", "96000", "192000", "384000"};
|
||||
|
||||
|
|
@ -43324,6 +43620,9 @@ static int msm_routing_probe(struct snd_soc_component *component)
|
|||
snd_soc_add_component_controls(component, adm_channel_config_controls,
|
||||
ARRAY_SIZE(adm_channel_config_controls));
|
||||
|
||||
snd_soc_add_component_controls(component, msm_asm_format_controls,
|
||||
ARRAY_SIZE(msm_asm_format_controls));
|
||||
|
||||
snd_soc_add_component_controls(component, aptx_dec_license_controls,
|
||||
ARRAY_SIZE(aptx_dec_license_controls));
|
||||
snd_soc_add_component_controls(component,
|
||||
|
|
|
|||
19
techpack/audio/asoc/msm-pcm-routing-v2.h
Executable file → Normal file
19
techpack/audio/asoc/msm-pcm-routing-v2.h
Executable file → Normal file
|
|
@ -2,6 +2,10 @@
|
|||
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Add support for 24 and 32bit format for ASM loopback and playback session.
|
||||
*/
|
||||
|
||||
#ifndef _MSM_PCM_ROUTING_H
|
||||
#define _MSM_PCM_ROUTING_H
|
||||
#include <dsp/apr_audio-v2.h>
|
||||
|
|
@ -757,6 +761,20 @@ struct msm_pcm_channel_mixer_v2 {
|
|||
int be_id;
|
||||
bool is_used;
|
||||
};
|
||||
|
||||
struct msm_asm_config {
|
||||
u8 fe_id;
|
||||
u8 mode; /* playback=0, capture=1,loopback=2 */
|
||||
u8 bit_format;
|
||||
};
|
||||
|
||||
enum {
|
||||
MSM_ASM_PLAYBACK_MODE = 0,
|
||||
MSM_ASM_CAPTURE_MODE,
|
||||
MSM_ASM_LOOPBACK_MODE,
|
||||
MSM_ASM_MAX_MODE
|
||||
};
|
||||
|
||||
/* dai_id: front-end ID,
|
||||
* dspst_id: DSP audio stream ID
|
||||
* stream_type: playback or capture
|
||||
|
|
@ -807,6 +825,7 @@ int msm_pcm_routing_set_channel_mixer_runtime(
|
|||
|
||||
int msm_pcm_routing_set_stream_ec_ref_chmix_cfg(
|
||||
int fedai_id, struct msm_pcm_channel_mixer *cfg_data);
|
||||
int msm_pcm_asm_cfg_get(int fe_id, int mode);
|
||||
|
||||
|
||||
/* array element of usr elem */
|
||||
|
|
|
|||
|
|
@ -1039,21 +1039,27 @@ SND_SOC_DAILINK_DEFS(wsa_dma_rx0,
|
|||
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45056")),
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "wsa_macro_rx1"),
|
||||
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||
COMP_CODEC("wsa-codec2", "wsa_rx2")),
|
||||
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
||||
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||
|
||||
SND_SOC_DAILINK_DEFS(wsa_dma_rx1,
|
||||
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45058")),
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "wsa_macro_rx_mix"),
|
||||
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||
COMP_CODEC("wsa-codec2", "wsa_rx2")),
|
||||
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
||||
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||
|
||||
SND_SOC_DAILINK_DEFS(wsa_dma_tx1,
|
||||
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45059")),
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "wsa_macro_echo"),
|
||||
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||
COMP_CODEC("wsa-codec2", "wsa_rx2")),
|
||||
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
||||
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||
|
||||
SND_SOC_DAILINK_DEFS(rx_dma_rx0,
|
||||
|
|
|
|||
|
|
@ -660,6 +660,27 @@ static const char *const mi2s_ch_text[] = {"One", "Two", "Three", "Four",
|
|||
"Eight"};
|
||||
static const char *const qos_text[] = {"Disable", "Enable"};
|
||||
|
||||
static char const *tdm_pair_rx_format[] = {"PRI_TDM_RX_0", "PRI_TDM_RX_1",
|
||||
"PRI_TDM_RX_2", "PRI_TDM_RX_3",
|
||||
"PRI_TDM_RX_4", "PRI_TDM_RX_5",
|
||||
"PRI_TDM_RX_6", "PRI_TDM_RX_7",
|
||||
"SEC_TDM_RX_0", "SEC_TDM_RX_1",
|
||||
"SEC_TDM_RX_2", "SEC_TDM_RX_3",
|
||||
"SEC_TDM_RX_4", "SEC_TDM_RX_5",
|
||||
"SEC_TDM_RX_6", "SEC_TDM_RX_7",
|
||||
"TERT_TDM_RX_0", "TERT_TDM_RX_1",
|
||||
"TERT_TDM_RX_2", "TERT_TDM_RX_3",
|
||||
"TERT_TDM_RX_4", "TERT_TDM_RX_5",
|
||||
"TERT_TDM_RX_6", "TERT_TDM_RX_7",
|
||||
"QUAT_TDM_RX_0", "QUAT_TDM_RX_1",
|
||||
"QUAT_TDM_RX_2", "QUAT_TDM_RX_3",
|
||||
"QUAT_TDM_RX_4", "QUAT_TDM_RX_5",
|
||||
"QUAT_TDM_RX_6", "QUAT_TDM_RX_7",
|
||||
"QUIN_TDM_RX_0", "QUIN_TDM_RX_1",
|
||||
"QUIN_TDM_RX_2", "QUIN_TDM_RX_3",
|
||||
"QUIN_TDM_RX_4", "QUIN_TDM_RX_5",
|
||||
"QUIN_TDM_RX_6", "QUIN_TDM_RX_7"};
|
||||
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_chs, usb_ch_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_chs, usb_ch_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
|
||||
|
|
@ -713,6 +734,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text);
|
|||
static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_rx_format, bit_format_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(tdm_paired_rx_format, tdm_pair_rx_format);
|
||||
|
||||
static struct afe_clk_set internal_mclk[MCLK_MAX] = {
|
||||
{
|
||||
|
|
@ -2123,6 +2145,237 @@ static int tdm_tx_slot_mapping_put(struct snd_kcontrol *kcontrol,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int tdm_paired_rx_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int ret = 0;
|
||||
int mode = tdm_get_mode(kcontrol);
|
||||
/*
|
||||
*mode gets the TDM interface value
|
||||
*0: Primary , 1: secondary, 2: Tertiary, 3: Quaternary, 4: QUINARY
|
||||
*/
|
||||
if (mode < 0) {
|
||||
pr_err("%s: unsupported control: %s\n", __func__, kcontrol->id.name);
|
||||
return -EINVAL;
|
||||
}
|
||||
ucontrol->value.enumerated.item[0] = AFE_PORT_ID_INVALID;
|
||||
pr_debug("%s:Port Channel = %d", __func__, ucontrol->value.enumerated.item[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tdm_paired_rx_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int val = -1;
|
||||
int intf_idx = -1;
|
||||
int port_idx = -1;
|
||||
int index;
|
||||
int slot_array_index = 0;
|
||||
struct afe_tdm_port_config tdm_port;
|
||||
union afe_port_group_config tdm_group;
|
||||
struct afe_param_id_tdm_lane_cfg tdm_lane;
|
||||
int i = 0;
|
||||
int rc = 0;
|
||||
u16 num_bits_set = 0;
|
||||
int mode = tdm_get_mode(kcontrol);
|
||||
struct device_node *node = NULL;
|
||||
const uint32_t *port_id_array = NULL;
|
||||
uint32_t array_length = 0;
|
||||
static u32 num_tdm_group_ports;
|
||||
|
||||
if (mode < 0) {
|
||||
pr_err("%s: unsupported control: %s\n", __func__, kcontrol->id.name);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
memset(&tdm_port, 0, sizeof(tdm_port));
|
||||
memset(&tdm_group, 0, sizeof(tdm_group));
|
||||
memset(&tdm_lane, 0, sizeof(tdm_lane));
|
||||
|
||||
val = ucontrol->value.enumerated.item[0];
|
||||
intf_idx = val / MAX_PORTS_PER_INTF;
|
||||
port_idx = val % MAX_PORTS_PER_INTF;
|
||||
if (mode != intf_idx) {
|
||||
pr_err("%s:Wrong value given for TDM Interface %d", __func__, intf_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
pr_debug("%s:Port Channel = %d Interface = %d", __func__, port_idx, intf_idx);
|
||||
while (tdm_rx_slot_offset[intf_idx][port_idx][slot_array_index] != AFE_SLOT_MAPPING_OFFSET_INVALID)
|
||||
slot_array_index++;
|
||||
switch (intf_idx) {
|
||||
case TDM_PRI:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-pri-rx");
|
||||
break;
|
||||
case TDM_SEC:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-sec-rx");
|
||||
break;
|
||||
case TDM_TERT:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-tert-rx");
|
||||
break;
|
||||
case TDM_QUAT:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-quat-rx");
|
||||
break;
|
||||
case TDM_QUIN:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-quin-rx");
|
||||
break;
|
||||
default:
|
||||
pr_err("%s:Wrong interface present", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Group Cfg */
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-group-id",(u32 *)&tdm_group.tdm_cfg.group_id);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired Rx Group Id not in DT File %s\n",__func__,"qcom,msm-cpudai-tdm-group-id");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-group-num-ports",&num_tdm_group_ports);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired Rx Group Num Ports from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-group-num-ports");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (num_tdm_group_ports > AFE_GROUP_DEVICE_NUM_PORTS) {
|
||||
pr_err("%s:Paired Rx Group Num Ports %d greater than Max %d\n",__func__, num_tdm_group_ports,
|
||||
AFE_GROUP_DEVICE_NUM_PORTS);
|
||||
return -EINVAL;
|
||||
}
|
||||
/*
|
||||
*Will get the array of afe ports associated with the group id. and then are
|
||||
*converted from big endian to cpu's byte order values using be32_to_cpu function.
|
||||
*/
|
||||
port_id_array = of_get_property(node,"qcom,msm-cpudai-tdm-group-port-id",&array_length);
|
||||
if (port_id_array == NULL) {
|
||||
pr_err("%s:Paired rx port_id_array is not valid\n",__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (array_length != sizeof(uint32_t) * num_tdm_group_ports) {
|
||||
pr_err("%s:paired rx array_length is %d, expected is %zd\n",
|
||||
__func__, array_length,
|
||||
sizeof(uint32_t) * num_tdm_group_ports);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < AFE_GROUP_DEVICE_NUM_PORTS; i++)
|
||||
tdm_group.tdm_cfg.port_id[i] = AFE_PORT_INVALID;
|
||||
|
||||
for (i = 0; i < num_tdm_group_ports; i++) {
|
||||
index = (((u16)be32_to_cpu(port_id_array[i]))/2)% MAX_PORTS_PER_INTF;
|
||||
tdm_group.tdm_cfg.port_id[index] =
|
||||
(u16)be32_to_cpu(port_id_array[i]);
|
||||
pr_debug("%s:Paired rx group port id is 0x%x",__func__,tdm_group.tdm_cfg.port_id[index]);
|
||||
}
|
||||
|
||||
tdm_group.tdm_cfg.group_device_cfg_minor_version = AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG;
|
||||
tdm_group.tdm_cfg.reserved = 0;
|
||||
tdm_group.tdm_cfg.nslots_per_frame = tdm_slot[intf_idx].num;
|
||||
tdm_group.tdm_cfg.sample_rate = tdm_rx_cfg[intf_idx][port_idx].sample_rate;
|
||||
tdm_group.tdm_cfg.slot_width = tdm_slot[intf_idx].width;
|
||||
tdm_group.tdm_cfg.bit_width = tdm_group.tdm_cfg.slot_width;
|
||||
|
||||
/* Lane Cfg */
|
||||
tdm_lane.port_id = tdm_group.group_cfg.group_id;
|
||||
tdm_lane.lane_mask = AFE_LANE_MASK_INVALID;
|
||||
if (of_find_property(node,"qcom,msm-cpudai-tdm-lane-mask", NULL)) {
|
||||
rc = of_property_read_u16(node,"qcom,msm-cpudai-tdm-lane-mask",&tdm_lane.lane_mask);
|
||||
if (rc) {
|
||||
pr_err("%s: value for tdm lane mask not found %s\n",__func__, "qcom,msm-cpudai-tdm-lane-mask");
|
||||
return -EINVAL;
|
||||
}
|
||||
pr_debug("%s: tdm lane mask from DT file %d\n",__func__, tdm_lane.lane_mask);
|
||||
} else
|
||||
pr_debug("%s: tdm lane mask not found\n", __func__);
|
||||
if (tdm_lane.lane_mask != AFE_LANE_MASK_INVALID) {
|
||||
num_bits_set = num_of_bits_set(tdm_lane.lane_mask);
|
||||
tdm_group.tdm_cfg.num_channels = tdm_group.tdm_cfg.nslots_per_frame * num_bits_set;
|
||||
} else {
|
||||
tdm_group.tdm_cfg.num_channels = tdm_group.tdm_cfg.nslots_per_frame;
|
||||
}
|
||||
|
||||
/* TDM Cfg */
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-sync-mode",(u32 *)&tdm_port.tdm.sync_mode);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Sync Mode from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-sync-mode");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-sync-src",(u32 *)&tdm_port.tdm.sync_src);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Sync Src from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-sync-src");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-data-out",(u32 *)&tdm_port.tdm.ctrl_data_out_enable);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Data Out from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-data-out");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-invert-sync",(u32 *)&tdm_port.tdm.ctrl_invert_sync_pulse);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Invert Sync from DT file %s\n",
|
||||
__func__, "qcom,msm-cpudai-tdm-invert-sync");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-data-delay",(u32 *)&tdm_port.tdm.ctrl_sync_data_delay);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Data Delay from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-data-delay");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* TDM Cfg */
|
||||
tdm_port.tdm.data_format = AFE_LINEAR_PCM_DATA;
|
||||
tdm_port.tdm.tdm_cfg_minor_version = AFE_API_VERSION_TDM_CONFIG;
|
||||
tdm_port.tdm.num_channels = tdm_rx_cfg[intf_idx][port_idx].channels;
|
||||
tdm_port.tdm.sample_rate = tdm_rx_cfg[intf_idx][port_idx].sample_rate;
|
||||
tdm_port.tdm.bit_width = tdm_slot[intf_idx].width;
|
||||
tdm_port.tdm.nslots_per_frame = tdm_slot[intf_idx].num;
|
||||
tdm_port.tdm.slot_width = tdm_slot[intf_idx].width;
|
||||
|
||||
/* Slot Mapping Cfg */
|
||||
tdm_port.slot_mapping.num_channel = tdm_rx_cfg[intf_idx][port_idx].channels;
|
||||
tdm_port.slot_mapping.bitwidth = tdm_slot[intf_idx].width;
|
||||
tdm_port.slot_mapping.data_align_type = AFE_SLOT_MAPPING_DATA_ALIGN_MSB;
|
||||
tdm_port.slot_mapping.minor_version = AFE_API_VERSION_SLOT_MAPPING_CONFIG;
|
||||
|
||||
/* Slot Mapping v2 Cfg */
|
||||
tdm_port.slot_mapping_v2.num_channel = tdm_rx_cfg[intf_idx][port_idx].channels;
|
||||
tdm_port.slot_mapping_v2.bitwidth = tdm_slot[intf_idx].width;
|
||||
tdm_port.slot_mapping_v2.data_align_type = AFE_SLOT_MAPPING_DATA_ALIGN_MSB;
|
||||
tdm_port.slot_mapping_v2.minor_version = AFE_API_VERSION_SLOT_MAPPING_CONFIG_V2;
|
||||
|
||||
for (i = 0; (i < slot_array_index) && (i < AFE_PORT_MAX_AUDIO_CHAN_CNT); i++)
|
||||
tdm_port.slot_mapping.offset[i] = tdm_rx_slot_offset[intf_idx][port_idx][i];
|
||||
|
||||
for (i = slot_array_index; i < AFE_PORT_MAX_AUDIO_CHAN_CNT ; i++)
|
||||
tdm_port.slot_mapping.offset[i] = AFE_SLOT_MAPPING_OFFSET_INVALID;
|
||||
|
||||
for (i = 0; (i < slot_array_index) && (i < AFE_PORT_MAX_AUDIO_CHAN_CNT_V2) ; i++)
|
||||
tdm_port.slot_mapping_v2.offset[i] = tdm_rx_slot_offset[intf_idx][port_idx][i];
|
||||
|
||||
for (i = slot_array_index; i < AFE_PORT_MAX_AUDIO_CHAN_CNT_V2 ; i++)
|
||||
tdm_port.slot_mapping_v2.offset[i] = AFE_SLOT_MAPPING_OFFSET_INVALID;
|
||||
|
||||
for (i = 0; i < tdm_slot[intf_idx].num ; i++)
|
||||
tdm_port.tdm.slot_mask |= 1 << i;
|
||||
|
||||
tdm_port.custom_tdm_header.minor_version = AFE_API_VERSION_CUSTOM_TDM_HEADER_CONFIG;
|
||||
tdm_port.custom_tdm_header.header_type = AFE_CUSTOM_TDM_HEADER_TYPE_INVALID;
|
||||
|
||||
tdm_group.tdm_cfg.slot_mask = tdm_port.tdm.slot_mask;
|
||||
|
||||
pr_debug("%s:Paired Rx Info\n"
|
||||
"Group Id: 0x%x, Group Num Ports: 0x%x, Sync Mode: 0x%x\n"
|
||||
"Sync Src: 0x%x, Data Out: 0x%x, Invert Sync: 0x%x, Data Delay: 0x%x\n",
|
||||
__func__, tdm_group.tdm_cfg.group_id, num_tdm_group_ports,
|
||||
tdm_port.tdm.sync_mode, tdm_port.tdm.sync_src,
|
||||
tdm_port.tdm.ctrl_data_out_enable, tdm_port.tdm.ctrl_invert_sync_pulse,
|
||||
tdm_port.tdm.ctrl_sync_data_delay);
|
||||
afe_tdm_paired_rx_cfg_val(intf_idx, tdm_group.tdm_cfg.port_id[port_idx], tdm_group, tdm_port, tdm_lane);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aux_pcm_get_port_idx(struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
int idx;
|
||||
|
|
@ -3326,6 +3579,16 @@ static const struct snd_kcontrol_new msm_snd_controls[] = {
|
|||
msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put),
|
||||
SOC_ENUM_EXT("QUIN_AUX_PCM_TX Format", aux_pcm_tx_format,
|
||||
msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put),
|
||||
SOC_ENUM_EXT("PRI_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("SEC_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("TERT_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("QUAT_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("QUIN_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
};
|
||||
|
||||
static inline int param_is_mask(int p)
|
||||
|
|
@ -4930,8 +5193,11 @@ static int sa6155_tdm_snd_startup(struct snd_pcm_substream *substream)
|
|||
*/
|
||||
intf_conf = &pdata->tdm_intf_conf[index];
|
||||
mutex_lock(&intf_conf->lock);
|
||||
|
||||
pr_debug("%s: intf_conf->ref_cnt = %d, index = %d\n", __func__, intf_conf->ref_cnt, index);
|
||||
|
||||
if (++intf_conf->ref_cnt == 1) {
|
||||
if (index == TDM_TERT || index == TDM_QUAT ||
|
||||
if (index == TDM_TERT || index == TDM_QUAT || index == TDM_SEC ||
|
||||
index == TDM_QUIN) {
|
||||
pinctrl_info = &pdata->pinctrl_info[index];
|
||||
if (pinctrl_info->pinctrl) {
|
||||
|
|
@ -4940,6 +5206,8 @@ static int sa6155_tdm_snd_startup(struct snd_pcm_substream *substream)
|
|||
if (ret_pinctrl)
|
||||
pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
|
||||
__func__, ret_pinctrl);
|
||||
} else {
|
||||
pr_err("%s: No set_pinctrl entity for [%d]...\n", __func__, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -892,6 +892,27 @@ static const char *const mi2s_ch_text[] = {"One", "Two", "Three", "Four",
|
|||
"Eight"};
|
||||
static const char *const qos_text[] = {"Disable", "Enable"};
|
||||
|
||||
static char const *tdm_pair_rx_format[] = {"PRI_TDM_RX_0", "PRI_TDM_RX_1",
|
||||
"PRI_TDM_RX_2", "PRI_TDM_RX_3",
|
||||
"PRI_TDM_RX_4", "PRI_TDM_RX_5",
|
||||
"PRI_TDM_RX_6", "PRI_TDM_RX_7",
|
||||
"SEC_TDM_RX_0", "SEC_TDM_RX_1",
|
||||
"SEC_TDM_RX_2", "SEC_TDM_RX_3",
|
||||
"SEC_TDM_RX_4", "SEC_TDM_RX_5",
|
||||
"SEC_TDM_RX_6", "SEC_TDM_RX_7",
|
||||
"TERT_TDM_RX_0", "TERT_TDM_RX_1",
|
||||
"TERT_TDM_RX_2", "TERT_TDM_RX_3",
|
||||
"TERT_TDM_RX_4", "TERT_TDM_RX_5",
|
||||
"TERT_TDM_RX_6", "TERT_TDM_RX_7",
|
||||
"QUAT_TDM_RX_0", "QUAT_TDM_RX_1",
|
||||
"QUAT_TDM_RX_2", "QUAT_TDM_RX_3",
|
||||
"QUAT_TDM_RX_4", "QUAT_TDM_RX_5",
|
||||
"QUAT_TDM_RX_6", "QUAT_TDM_RX_7",
|
||||
"QUIN_TDM_RX_0", "QUIN_TDM_RX_1",
|
||||
"QUIN_TDM_RX_2", "QUIN_TDM_RX_3",
|
||||
"QUIN_TDM_RX_4", "QUIN_TDM_RX_5",
|
||||
"QUIN_TDM_RX_6", "QUIN_TDM_RX_7"};
|
||||
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_chs, usb_ch_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_chs, usb_ch_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
|
||||
|
|
@ -946,6 +967,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text);
|
|||
static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_rx_format, bit_format_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text);
|
||||
static SOC_ENUM_SINGLE_EXT_DECL(tdm_paired_rx_format, tdm_pair_rx_format);
|
||||
|
||||
static struct afe_clk_set internal_mclk[MCLK_MAX] = {
|
||||
{
|
||||
|
|
@ -2392,6 +2414,237 @@ static int tdm_tx_slot_mapping_put(struct snd_kcontrol *kcontrol,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int tdm_paired_rx_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int ret = 0;
|
||||
int mode = tdm_get_mode(kcontrol);
|
||||
/*
|
||||
*mode gets the TDM interface value
|
||||
*0: Primary , 1: secondary, 2: Tertiary, 3: Quaternary, 4: QUINARY
|
||||
*/
|
||||
if (mode < 0) {
|
||||
pr_err("%s: unsupported control: %s\n", __func__, kcontrol->id.name);
|
||||
return -EINVAL;
|
||||
}
|
||||
ucontrol->value.enumerated.item[0] = AFE_PORT_ID_INVALID;
|
||||
pr_debug("%s:Port Channel = %d", __func__, ucontrol->value.enumerated.item[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tdm_paired_rx_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int val = -1;
|
||||
int intf_idx = -1;
|
||||
int port_idx = -1;
|
||||
int index;
|
||||
int slot_array_index = 0;
|
||||
struct afe_tdm_port_config tdm_port;
|
||||
union afe_port_group_config tdm_group;
|
||||
struct afe_param_id_tdm_lane_cfg tdm_lane;
|
||||
int i = 0;
|
||||
int rc = 0;
|
||||
u16 num_bits_set = 0;
|
||||
int mode = tdm_get_mode(kcontrol);
|
||||
struct device_node *node = NULL;
|
||||
const uint32_t *port_id_array = NULL;
|
||||
uint32_t array_length = 0;
|
||||
static u32 num_tdm_group_ports;
|
||||
|
||||
if (mode < 0) {
|
||||
pr_err("%s: unsupported control: %s\n", __func__, kcontrol->id.name);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
memset(&tdm_port, 0, sizeof(tdm_port));
|
||||
memset(&tdm_group, 0, sizeof(tdm_group));
|
||||
memset(&tdm_lane, 0, sizeof(tdm_lane));
|
||||
|
||||
val = ucontrol->value.enumerated.item[0];
|
||||
intf_idx = val / MAX_PORTS_PER_INTF;
|
||||
port_idx = val % MAX_PORTS_PER_INTF;
|
||||
if (mode != intf_idx) {
|
||||
pr_err("%s:Wrong value given for TDM Interface %d", __func__, intf_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
pr_debug("%s:Port Channel = %d Interface = %d", __func__, port_idx, intf_idx);
|
||||
while (tdm_rx_slot_offset[intf_idx][port_idx][slot_array_index] != AFE_SLOT_MAPPING_OFFSET_INVALID)
|
||||
slot_array_index++;
|
||||
switch (intf_idx) {
|
||||
case TDM_PRI:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-pri-rx");
|
||||
break;
|
||||
case TDM_SEC:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-sec-rx");
|
||||
break;
|
||||
case TDM_TERT:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-tert-rx");
|
||||
break;
|
||||
case TDM_QUAT:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-quat-rx");
|
||||
break;
|
||||
case TDM_QUIN:
|
||||
node = of_find_node_by_path("/soc/qcom,msm-dai-tdm-quin-rx");
|
||||
break;
|
||||
default:
|
||||
pr_err("%s:Wrong interface present", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Group Cfg */
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-group-id",(u32 *)&tdm_group.tdm_cfg.group_id);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired Rx Group Id not in DT File %s\n",__func__,"qcom,msm-cpudai-tdm-group-id");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-group-num-ports",&num_tdm_group_ports);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired Rx Group Num Ports from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-group-num-ports");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (num_tdm_group_ports > AFE_GROUP_DEVICE_NUM_PORTS) {
|
||||
pr_err("%s:Paired Rx Group Num Ports %d greater than Max %d\n",__func__, num_tdm_group_ports,
|
||||
AFE_GROUP_DEVICE_NUM_PORTS);
|
||||
return -EINVAL;
|
||||
}
|
||||
/*
|
||||
*Will get the array of afe ports associated with the group id. and then are
|
||||
*converted from big endian to cpu's byte order values using be32_to_cpu function.
|
||||
*/
|
||||
port_id_array = of_get_property(node,"qcom,msm-cpudai-tdm-group-port-id",&array_length);
|
||||
if (port_id_array == NULL) {
|
||||
pr_err("%s:Paired rx port_id_array is not valid\n",__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (array_length != sizeof(uint32_t) * num_tdm_group_ports) {
|
||||
pr_err("%s:paired rx array_length is %d, expected is %zd\n",
|
||||
__func__, array_length,
|
||||
sizeof(uint32_t) * num_tdm_group_ports);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < AFE_GROUP_DEVICE_NUM_PORTS; i++)
|
||||
tdm_group.tdm_cfg.port_id[i] = AFE_PORT_INVALID;
|
||||
|
||||
for (i = 0; i < num_tdm_group_ports; i++) {
|
||||
index = (((u16)be32_to_cpu(port_id_array[i]))/2)% MAX_PORTS_PER_INTF;
|
||||
tdm_group.tdm_cfg.port_id[index] =
|
||||
(u16)be32_to_cpu(port_id_array[i]);
|
||||
pr_debug("%s:Paired rx group port id is 0x%x",__func__,tdm_group.tdm_cfg.port_id[index]);
|
||||
}
|
||||
|
||||
tdm_group.tdm_cfg.group_device_cfg_minor_version = AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG;
|
||||
tdm_group.tdm_cfg.reserved = 0;
|
||||
tdm_group.tdm_cfg.nslots_per_frame = tdm_slot[intf_idx].num;
|
||||
tdm_group.tdm_cfg.sample_rate = tdm_rx_cfg[intf_idx][port_idx].sample_rate;
|
||||
tdm_group.tdm_cfg.slot_width = tdm_slot[intf_idx].width;
|
||||
tdm_group.tdm_cfg.bit_width = tdm_group.tdm_cfg.slot_width;
|
||||
|
||||
/* Lane Cfg */
|
||||
tdm_lane.port_id = tdm_group.group_cfg.group_id;
|
||||
tdm_lane.lane_mask = AFE_LANE_MASK_INVALID;
|
||||
if (of_find_property(node,"qcom,msm-cpudai-tdm-lane-mask", NULL)) {
|
||||
rc = of_property_read_u16(node,"qcom,msm-cpudai-tdm-lane-mask",&tdm_lane.lane_mask);
|
||||
if (rc) {
|
||||
pr_err("%s: value for tdm lane mask not found %s\n",__func__, "qcom,msm-cpudai-tdm-lane-mask");
|
||||
return -EINVAL;
|
||||
}
|
||||
pr_debug("%s: tdm lane mask from DT file %d\n",__func__, tdm_lane.lane_mask);
|
||||
} else
|
||||
pr_debug("%s: tdm lane mask not found\n", __func__);
|
||||
if (tdm_lane.lane_mask != AFE_LANE_MASK_INVALID) {
|
||||
num_bits_set = num_of_bits_set(tdm_lane.lane_mask);
|
||||
tdm_group.tdm_cfg.num_channels = tdm_group.tdm_cfg.nslots_per_frame * num_bits_set;
|
||||
} else {
|
||||
tdm_group.tdm_cfg.num_channels = tdm_group.tdm_cfg.nslots_per_frame;
|
||||
}
|
||||
|
||||
/* TDM Cfg */
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-sync-mode",(u32 *)&tdm_port.tdm.sync_mode);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Sync Mode from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-sync-mode");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-sync-src",(u32 *)&tdm_port.tdm.sync_src);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Sync Src from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-sync-src");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-data-out",(u32 *)&tdm_port.tdm.ctrl_data_out_enable);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Data Out from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-data-out");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-invert-sync",(u32 *)&tdm_port.tdm.ctrl_invert_sync_pulse);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Invert Sync from DT file %s\n",
|
||||
__func__, "qcom,msm-cpudai-tdm-invert-sync");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(node,"qcom,msm-cpudai-tdm-data-delay",(u32 *)&tdm_port.tdm.ctrl_sync_data_delay);
|
||||
if (rc) {
|
||||
pr_err("%s:Paired rx Data Delay from DT file %s\n",__func__, "qcom,msm-cpudai-tdm-data-delay");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* TDM Cfg */
|
||||
tdm_port.tdm.data_format = AFE_LINEAR_PCM_DATA;
|
||||
tdm_port.tdm.tdm_cfg_minor_version = AFE_API_VERSION_TDM_CONFIG;
|
||||
tdm_port.tdm.num_channels = tdm_rx_cfg[intf_idx][port_idx].channels;
|
||||
tdm_port.tdm.sample_rate = tdm_rx_cfg[intf_idx][port_idx].sample_rate;
|
||||
tdm_port.tdm.bit_width = tdm_slot[intf_idx].width;
|
||||
tdm_port.tdm.nslots_per_frame = tdm_slot[intf_idx].num;
|
||||
tdm_port.tdm.slot_width = tdm_slot[intf_idx].width;
|
||||
|
||||
/* Slot Mapping Cfg */
|
||||
tdm_port.slot_mapping.num_channel = tdm_rx_cfg[intf_idx][port_idx].channels;
|
||||
tdm_port.slot_mapping.bitwidth = tdm_slot[intf_idx].width;
|
||||
tdm_port.slot_mapping.data_align_type = AFE_SLOT_MAPPING_DATA_ALIGN_MSB;
|
||||
tdm_port.slot_mapping.minor_version = AFE_API_VERSION_SLOT_MAPPING_CONFIG;
|
||||
|
||||
/* Slot Mapping v2 Cfg */
|
||||
tdm_port.slot_mapping_v2.num_channel = tdm_rx_cfg[intf_idx][port_idx].channels;
|
||||
tdm_port.slot_mapping_v2.bitwidth = tdm_slot[intf_idx].width;
|
||||
tdm_port.slot_mapping_v2.data_align_type = AFE_SLOT_MAPPING_DATA_ALIGN_MSB;
|
||||
tdm_port.slot_mapping_v2.minor_version = AFE_API_VERSION_SLOT_MAPPING_CONFIG_V2;
|
||||
|
||||
for (i = 0; (i < slot_array_index) && (i < AFE_PORT_MAX_AUDIO_CHAN_CNT); i++)
|
||||
tdm_port.slot_mapping.offset[i] = tdm_rx_slot_offset[intf_idx][port_idx][i];
|
||||
|
||||
for (i = slot_array_index; i < AFE_PORT_MAX_AUDIO_CHAN_CNT ; i++)
|
||||
tdm_port.slot_mapping.offset[i] = AFE_SLOT_MAPPING_OFFSET_INVALID;
|
||||
|
||||
for (i = 0; (i < slot_array_index) && (i < AFE_PORT_MAX_AUDIO_CHAN_CNT_V2) ; i++)
|
||||
tdm_port.slot_mapping_v2.offset[i] = tdm_rx_slot_offset[intf_idx][port_idx][i];
|
||||
|
||||
for (i = slot_array_index; i < AFE_PORT_MAX_AUDIO_CHAN_CNT_V2 ; i++)
|
||||
tdm_port.slot_mapping_v2.offset[i] = AFE_SLOT_MAPPING_OFFSET_INVALID;
|
||||
|
||||
for (i = 0; i < tdm_slot[intf_idx].num ; i++)
|
||||
tdm_port.tdm.slot_mask |= 1 << i;
|
||||
|
||||
tdm_port.custom_tdm_header.minor_version = AFE_API_VERSION_CUSTOM_TDM_HEADER_CONFIG;
|
||||
tdm_port.custom_tdm_header.header_type = AFE_CUSTOM_TDM_HEADER_TYPE_INVALID;
|
||||
|
||||
tdm_group.tdm_cfg.slot_mask = tdm_port.tdm.slot_mask;
|
||||
|
||||
pr_debug("%s:Paired Rx Info\n"
|
||||
"Group Id: 0x%x, Group Num Ports: 0x%x, Sync Mode: 0x%x\n"
|
||||
"Sync Src: 0x%x, Data Out: 0x%x, Invert Sync: 0x%x, Data Delay: 0x%x\n",
|
||||
__func__, tdm_group.tdm_cfg.group_id, num_tdm_group_ports,
|
||||
tdm_port.tdm.sync_mode, tdm_port.tdm.sync_src,
|
||||
tdm_port.tdm.ctrl_data_out_enable, tdm_port.tdm.ctrl_invert_sync_pulse,
|
||||
tdm_port.tdm.ctrl_sync_data_delay);
|
||||
afe_tdm_paired_rx_cfg_val(intf_idx, tdm_group.tdm_cfg.port_id[port_idx], tdm_group, tdm_port, tdm_lane);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aux_pcm_get_port_idx(struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
int idx;
|
||||
|
|
@ -3597,6 +3850,16 @@ static const struct snd_kcontrol_new msm_common_snd_controls[] = {
|
|||
msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put),
|
||||
SOC_ENUM_EXT("QUIN_AUX_PCM_TX Format", aux_pcm_tx_format,
|
||||
msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put),
|
||||
SOC_ENUM_EXT("PRI_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("SEC_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("TERT_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("QUAT_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
SOC_ENUM_EXT("QUIN_TDM Paired_Rx", tdm_paired_rx_format,
|
||||
tdm_paired_rx_get, tdm_paired_rx_put),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new sa8295_msm_snd_controls[] = {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,8 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
# Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
|
||||
ifeq ($(CONFIG_QGKI), y)
|
||||
export CONFIG_SND_SOC_GVM_AUTO_SPF=m
|
||||
export CONFIG_MSM_QDSP6_APRV2_VM=m
|
||||
export CONFIG_MSM_QDSP6_SSR=m
|
||||
export CONFIG_MSM_ADSP_LOADER=m
|
||||
export CONFIG_MSM_QDSP6_NOTIFIER=m
|
||||
export CONFIG_SND_SOC_MSM_QDSP6V2_VM=m
|
||||
export CONFIG_SND_SOC_QDSP6V2=m
|
||||
export CONFIG_QTI_PP=m
|
||||
export CONFIG_SND_HWDEP_ROUTING=m
|
||||
export CONFIG_SND_SOC_MSM_STUB=m
|
||||
export CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
|
||||
export CONFIG_MSM_QDSP6V2_CODECS=m
|
||||
export CONFIG_SND_EVENT=m
|
||||
export CONFIG_SND_SOC_SA8155=m
|
||||
endif
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
|
@ -11,17 +12,5 @@
|
|||
*/
|
||||
|
||||
#define CONFIG_SND_SOC_GVM_AUTO_SPF 1
|
||||
#define CONFIG_MSM_QDSP6_APRV2_VM 1
|
||||
#define CONFIG_MSM_ADSP_LOADER 1
|
||||
#define CONFIG_MSM_QDSP6_SSR 1
|
||||
#define CONFIG_MSM_QDSP6_NOTIFIER 1
|
||||
#define CONFIG_SND_SOC_MSM_QDSP6V2_VM 1
|
||||
#define CONFIG_SND_SOC_QDSP6V2 1
|
||||
#define CONFIG_QTI_PP 1
|
||||
#define CONFIG_SND_HWDEP_ROUTING 1
|
||||
#define CONFIG_SND_SOC_MSM_STUB 1
|
||||
#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
|
||||
#define CONFIG_MSM_QDSP6V2_CODECS 1
|
||||
#define CONFIG_SND_EVENT 1
|
||||
#define CONFIG_SND_SOC_SA8155 1
|
||||
|
||||
|
|
|
|||
|
|
@ -47,3 +47,4 @@ export CONFIG_SND_SOC_WCD937X=m
|
|||
export CONFIG_SND_SOC_WCD937X_SLAVE=m
|
||||
export CONFIG_SND_EVENT=m
|
||||
export CONFIG_HSIF_DISABLE=m
|
||||
export CONFIG_DIGITAL_CDC_RSC_MGR=m
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@
|
|||
#define CONFIG_SND_SOC_WCD937X_SLAVE 1
|
||||
#define CONFIG_SND_EVENT 1
|
||||
#define CONFIG_HSIF_DISABLE 1
|
||||
#define CONFIG_DIGITAL_CDC_RSC_MGR 1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
|
@ -33,7 +34,6 @@ int digital_cdc_rsc_mgr_hw_vote_enable(struct clk* vote_handle)
|
|||
mutex_unlock(&hw_vote_lock);
|
||||
|
||||
pr_debug("%s: return %d\n", __func__, ret);
|
||||
trace_printk("%s: return %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(digital_cdc_rsc_mgr_hw_vote_enable);
|
||||
|
|
@ -55,7 +55,7 @@ void digital_cdc_rsc_mgr_hw_vote_disable(struct clk* vote_handle)
|
|||
mutex_lock(&hw_vote_lock);
|
||||
clk_disable_unprepare(vote_handle);
|
||||
mutex_unlock(&hw_vote_lock);
|
||||
trace_printk("%s\n", __func__);
|
||||
pr_debug("%s\n", __func__);
|
||||
}
|
||||
EXPORT_SYMBOL(digital_cdc_rsc_mgr_hw_vote_disable);
|
||||
|
||||
|
|
@ -79,7 +79,6 @@ void digital_cdc_rsc_mgr_hw_vote_reset(struct clk* vote_handle)
|
|||
count++;
|
||||
}
|
||||
pr_debug("%s: Vote count after SSR: %d\n", __func__, count);
|
||||
trace_printk("%s: Vote count after SSR: %d\n", __func__, count);
|
||||
|
||||
while (count--)
|
||||
clk_prepare_enable(vote_handle);
|
||||
|
|
|
|||
241
techpack/audio/dsp/q6afe.c
Executable file → Normal file
241
techpack/audio/dsp/q6afe.c
Executable file → Normal file
|
|
@ -31,6 +31,16 @@
|
|||
#define SP_V4_NUM_MAX_SPKRS SP_V2_NUM_MAX_SPKRS
|
||||
#define MAX_LSM_SESSIONS 8
|
||||
|
||||
/* Paired Rx Structure Info */
|
||||
static struct afe_tdm_intf_paired_rx_cfg afe_tdm_paired_rx_cfg[AFE_TDM_INTERFACE_MAX] = {
|
||||
{0}, /*Primary*/
|
||||
{0}, /*secondary*/
|
||||
{0}, /*Tertiary*/
|
||||
{0}, /*Quaternary*/
|
||||
{0}, /*QUINARY*/
|
||||
};
|
||||
static atomic_t afe_tdm_port_ref[AFE_MAX_PORTS] = {0};
|
||||
|
||||
struct afe_avcs_payload_port_mapping {
|
||||
u16 port_id;
|
||||
struct avcs_load_unload_modules_payload *payload;
|
||||
|
|
@ -674,13 +684,7 @@ static void av_dev_drift_afe_cb_handler(uint32_t opcode, uint32_t *payload,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this_afe.av_dev_drift_resp.status) {
|
||||
atomic_set(&this_afe.state, 0);
|
||||
} else {
|
||||
pr_debug("%s: av_dev_drift_resp status: %d\n", __func__,
|
||||
this_afe.av_dev_drift_resp.status);
|
||||
atomic_set(&this_afe.state, -1);
|
||||
}
|
||||
atomic_set(&this_afe.state, 0);
|
||||
}
|
||||
|
||||
static void doa_tracking_mon_afe_cb_handler(uint32_t opcode, uint32_t *payload,
|
||||
|
|
@ -1499,8 +1503,6 @@ static int afe_apr_send_pkt(void *data, wait_queue_head_t *wait)
|
|||
pr_err_ratelimited("%s: request timedout\n",
|
||||
__func__);
|
||||
ret = -ETIMEDOUT;
|
||||
trace_printk("%s: wait for ADSP response timed out\n",
|
||||
__func__);
|
||||
} else if (atomic_read(&this_afe.status) > 0) {
|
||||
pr_err("%s: DSP returned error[%s]\n", __func__,
|
||||
adsp_err_get_err_str(atomic_read(
|
||||
|
|
@ -2144,31 +2146,30 @@ static int afe_send_cal_block(u16 port_id, struct cal_block_data *cal_block)
|
|||
result = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (cal_block->cal_data.size < 0) {
|
||||
pr_debug("%s: AFE cal has invalid size!\n", __func__);
|
||||
result = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (cal_block->cal_data.size == 0) {
|
||||
pr_debug("%s: AFE cal size is zero!\n", __func__);
|
||||
goto done;
|
||||
}
|
||||
payload_size = cal_block->cal_data.size;
|
||||
mem_hdr.data_payload_addr_lsw =
|
||||
lower_32_bits(cal_block->cal_data.paddr);
|
||||
mem_hdr.data_payload_addr_msw =
|
||||
msm_audio_populate_upper_32_bits(cal_block->cal_data.paddr);
|
||||
mem_hdr.mem_map_handle = cal_block->map_data.q6map_handle;
|
||||
if (cal_block->cal_data.size != 0) {
|
||||
payload_size = cal_block->cal_data.size;
|
||||
mem_hdr.data_payload_addr_lsw =
|
||||
lower_32_bits(cal_block->cal_data.paddr);
|
||||
mem_hdr.data_payload_addr_msw =
|
||||
msm_audio_populate_upper_32_bits(cal_block->cal_data.paddr);
|
||||
mem_hdr.mem_map_handle = cal_block->map_data.q6map_handle;
|
||||
|
||||
pr_debug("%s: AFE cal sent for device port = 0x%x, cal size = %zd, cal addr = 0x%pK\n",
|
||||
__func__, port_id,
|
||||
cal_block->cal_data.size, &cal_block->cal_data.paddr);
|
||||
pr_debug("%s: AFE cal sent for device port = 0x%x, cal size = %zd, cal addr = 0x%pK\n",
|
||||
__func__, port_id,
|
||||
cal_block->cal_data.size, &cal_block->cal_data.paddr);
|
||||
|
||||
result = q6afe_set_params(port_id, q6audio_get_port_index(port_id),
|
||||
result = q6afe_set_params(port_id, q6audio_get_port_index(port_id),
|
||||
&mem_hdr, NULL, payload_size);
|
||||
if (result)
|
||||
pr_err("%s: AFE cal for port 0x%x failed %d\n",
|
||||
__func__, port_id, result);
|
||||
if (result)
|
||||
pr_err("%s: AFE cal for port 0x%x failed %d\n",
|
||||
__func__, port_id, result);
|
||||
}
|
||||
else {
|
||||
pr_debug("%s: AFE cal has invalid size!\n", __func__);
|
||||
result = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
done:
|
||||
return result;
|
||||
|
|
@ -2982,7 +2983,7 @@ int afe_send_cdc_dma_data_align(u16 port_id, u32 cdc_dma_data_align)
|
|||
{
|
||||
struct afe_param_id_cdc_dma_data_align data_align;
|
||||
struct param_hdr_v3 param_info;
|
||||
uint16_t port_index = 0;
|
||||
int port_index = 0;
|
||||
int ret = -EINVAL;
|
||||
|
||||
memset(&data_align, 0, sizeof(data_align));
|
||||
|
|
@ -3174,7 +3175,7 @@ static int afe_port_topology_deregister(u16 port_id)
|
|||
uint32_t build_major_version = 0;
|
||||
uint32_t build_minor_version = 0;
|
||||
uint32_t build_branch_version = 0;
|
||||
uint32_t afe_api_version = 0;
|
||||
int afe_api_version = 0;
|
||||
|
||||
ret = q6core_get_avcs_avs_build_version_info(&build_major_version,
|
||||
&build_minor_version,
|
||||
|
|
@ -3349,8 +3350,6 @@ int afe_send_port_power_mode(u16 port_id)
|
|||
}
|
||||
pr_debug("%s: AFE set power mode 0x%x enable for port 0x%x ret %d\n",
|
||||
__func__, power_mode, port_id, ret);
|
||||
trace_printk("%s: AFE set power mode 0x%x enable for port 0x%x ret %d\n",
|
||||
__func__, power_mode, port_id, ret);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_send_port_power_mode);
|
||||
|
|
@ -3426,8 +3425,6 @@ int afe_send_port_island_mode(u16 port_id)
|
|||
}
|
||||
pr_debug("%s: AFE set island mode 0x%x enable for port 0x%x ret %d\n",
|
||||
__func__, island_mode, port_id, ret);
|
||||
trace_printk("%s: AFE set island mode 0x%x enable for port 0x%x ret %d\n",
|
||||
__func__, island_mode, port_id, ret);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_send_port_island_mode);
|
||||
|
|
@ -4567,6 +4564,7 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
|
|||
uint16_t port_index = 0;
|
||||
enum afe_mad_type mad_type = MAD_HW_NONE;
|
||||
int ret = 0;
|
||||
atomic_t *port_ref = NULL;
|
||||
|
||||
if (!tdm_port) {
|
||||
pr_err("%s: Error, no configuration data\n", __func__);
|
||||
|
|
@ -4582,6 +4580,7 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
|
|||
__func__, index);
|
||||
return -EINVAL;
|
||||
}
|
||||
port_ref = &afe_tdm_port_ref[index];
|
||||
ret = q6audio_validate_port(port_id);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: port id: 0x%x ret %d\n", __func__, port_id, ret);
|
||||
|
|
@ -4680,6 +4679,8 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
|
|||
}
|
||||
|
||||
ret = afe_send_cmd_port_start(port_id);
|
||||
if(!ret)
|
||||
atomic_inc(port_ref);
|
||||
|
||||
fail_cmd:
|
||||
return ret;
|
||||
|
|
@ -4776,9 +4777,6 @@ void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag)
|
|||
} else {
|
||||
port_index = afe_get_port_index(port_id);
|
||||
this_afe.island_mode[port_index] = enable_flag;
|
||||
|
||||
trace_printk("%s: set island mode cfg 0x%x for port 0x%x\n",
|
||||
__func__, this_afe.island_mode[port_index], port_id);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(afe_set_island_mode_cfg);
|
||||
|
|
@ -4791,7 +4789,7 @@ EXPORT_SYMBOL(afe_set_island_mode_cfg);
|
|||
*/
|
||||
int afe_get_power_mode_cfg(u16 port_id, u32 *enable_flag)
|
||||
{
|
||||
uint16_t port_index;
|
||||
int port_index;
|
||||
int ret = 0;
|
||||
|
||||
if (enable_flag) {
|
||||
|
|
@ -4815,7 +4813,7 @@ EXPORT_SYMBOL(afe_get_power_mode_cfg);
|
|||
*/
|
||||
int afe_set_power_mode_cfg(u16 port_id, u32 enable_flag)
|
||||
{
|
||||
uint16_t port_index;
|
||||
int port_index;
|
||||
int ret= 0;
|
||||
|
||||
port_index = afe_get_port_index(port_id);
|
||||
|
|
@ -4826,8 +4824,6 @@ int afe_set_power_mode_cfg(u16 port_id, u32 enable_flag)
|
|||
}
|
||||
this_afe.power_mode[port_index] = enable_flag;
|
||||
|
||||
trace_printk("%s: set power mode cfg 0x%x for port 0x%x\n",
|
||||
__func__, this_afe.power_mode[port_index], port_id);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_set_power_mode_cfg);
|
||||
|
|
@ -9334,6 +9330,7 @@ int afe_close(int port_id)
|
|||
u16 i;
|
||||
int index = 0;
|
||||
uint16_t port_index;
|
||||
atomic_t *port_ref = NULL;
|
||||
|
||||
memset(&stop, 0, sizeof(stop));
|
||||
|
||||
|
|
@ -9394,6 +9391,7 @@ int afe_close(int port_id)
|
|||
__func__, index);
|
||||
return -EINVAL;
|
||||
}
|
||||
port_ref = &afe_tdm_port_ref[index];
|
||||
ret = q6audio_validate_port(port_id);
|
||||
if (ret < 0) {
|
||||
pr_warn("%s: Not a valid port id 0x%x ret %d\n",
|
||||
|
|
@ -9458,8 +9456,11 @@ int afe_close(int port_id)
|
|||
stop.reserved = 0;
|
||||
|
||||
ret = afe_apr_send_pkt(&stop, &this_afe.wait[index]);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
pr_err("%s: AFE close failed %d\n", __func__, ret);
|
||||
} else {
|
||||
atomic_dec(port_ref);
|
||||
}
|
||||
|
||||
fail_cmd:
|
||||
if ((q6core_get_avcs_api_version_per_service(
|
||||
|
|
@ -9557,15 +9558,6 @@ int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg)
|
|||
cfg->clk_root, cfg->clk_set_mode,
|
||||
cfg->reserved, q6audio_get_port_id(port_id));
|
||||
|
||||
trace_printk("%s: Minor version =0x%x clk val1 = %d\n"
|
||||
"clk val2 = %d, clk src = 0x%x\n"
|
||||
"clk root = 0x%x clk mode = 0x%x resrv = 0x%x\n"
|
||||
"port id = 0x%x\n",
|
||||
__func__, cfg->i2s_cfg_minor_version,
|
||||
cfg->clk_val1, cfg->clk_val2, cfg->clk_src,
|
||||
cfg->clk_root, cfg->clk_set_mode,
|
||||
cfg->reserved, q6audio_get_port_id(port_id));
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_hdr, (u8 *) &clk_cfg);
|
||||
|
|
@ -9859,6 +9851,9 @@ stop_mclk:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ext_dyn_mclk_port_id;
|
||||
static int ext_dyn_clk_root = Q6AFE_LPASS_CLK_ROOT_DEFAULT;
|
||||
static struct afe_param_id_clock_set_v2_t ext_dyn_mclk;
|
||||
int afe_set_lpass_clk_cfg_ext_mclk_v2(int index, struct afe_param_id_clock_set_v2_t *dyn_mclk_cfg,
|
||||
uint32_t mclk_freq)
|
||||
{
|
||||
|
|
@ -9923,6 +9918,21 @@ int afe_set_lpass_clk_cfg_ext_mclk_v2(int index, struct afe_param_id_clock_set_v
|
|||
|
||||
mutex_unlock(&this_afe.afe_cmd_lock);
|
||||
|
||||
if (ext_dyn_clk_root != dyn_mclk_cfg->clk_root) {
|
||||
ext_dyn_mclk_port_id = index;
|
||||
ext_dyn_mclk.clk_set_minor_version = dyn_mclk_cfg->clk_set_minor_version;
|
||||
ext_dyn_mclk.clk_id = dyn_mclk_cfg->clk_id;
|
||||
ext_dyn_mclk.clk_freq_in_hz = dyn_mclk_cfg->clk_freq_in_hz;
|
||||
ext_dyn_mclk.clk_attri = dyn_mclk_cfg->clk_attri;
|
||||
ext_dyn_mclk.clk_root = dyn_mclk_cfg->clk_root;
|
||||
ext_dyn_mclk.enable = dyn_mclk_cfg->enable;
|
||||
ext_dyn_mclk.divider_2x = dyn_mclk_cfg->divider_2x;
|
||||
ext_dyn_mclk.m = dyn_mclk_cfg->m;
|
||||
ext_dyn_mclk.n = dyn_mclk_cfg->n;
|
||||
ext_dyn_mclk.d = dyn_mclk_cfg->d;
|
||||
|
||||
ext_dyn_clk_root = dyn_mclk_cfg->clk_root;
|
||||
}
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -9977,21 +9987,12 @@ int afe_set_lpass_clk_cfg(int index, struct afe_clk_set *cfg)
|
|||
cfg->clk_id, cfg->clk_freq_in_hz, cfg->clk_attri,
|
||||
cfg->clk_root, cfg->enable);
|
||||
|
||||
trace_printk("%s: Minor version =0x%x clk id = %d\n"
|
||||
"clk freq (Hz) = %d, clk attri = 0x%x\n"
|
||||
"clk root = 0x%x clk enable = 0x%x\n",
|
||||
__func__, cfg->clk_set_minor_version,
|
||||
cfg->clk_id, cfg->clk_freq_in_hz, cfg->clk_attri,
|
||||
cfg->clk_root, cfg->enable);
|
||||
|
||||
ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr,
|
||||
(u8 *) cfg);
|
||||
if (ret < 0) {
|
||||
if (__ratelimit(&rtl))
|
||||
pr_err_ratelimited("%s: AFE clk cfg failed with ret %d\n",
|
||||
__func__, ret);
|
||||
trace_printk("%s: AFE clk cfg failed with ret %d\n",
|
||||
__func__, ret);
|
||||
}
|
||||
mutex_unlock(&this_afe.afe_clk_lock);
|
||||
return ret;
|
||||
|
|
@ -10010,7 +10011,7 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
|
|||
{
|
||||
int index = 0;
|
||||
int ret = 0;
|
||||
u16 idx = 0;
|
||||
int idx = 0;
|
||||
uint32_t build_major_version = 0;
|
||||
uint32_t build_minor_version = 0;
|
||||
uint32_t build_branch_version = 0;
|
||||
|
|
@ -10049,6 +10050,7 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
ext_dyn_mclk.enable = cfg->enable;
|
||||
if (clkinfo_per_port[idx].mclk_src_id != MCLK_SRC_INT) {
|
||||
pr_debug("%s: ext MCLK src %d\n",
|
||||
__func__, clkinfo_per_port[idx].mclk_src_id);
|
||||
|
|
@ -10079,6 +10081,12 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
|
|||
|
||||
ret = afe_set_lpass_clk_cfg_ext_mclk(index, cfg,
|
||||
clkinfo_per_port[idx].mclk_freq);
|
||||
} else if (ext_dyn_mclk.clk_root != Q6AFE_LPASS_CLK_ROOT_DEFAULT) {
|
||||
ret = afe_set_lpass_clk_cfg_ext_mclk_v2(ext_dyn_mclk_port_id,
|
||||
&ext_dyn_mclk, 0);
|
||||
if (ret)
|
||||
pr_err("%s: AFE port logging setting for port 0x%x failed %d\n",
|
||||
__func__, ext_dyn_mclk_port_id, ret);
|
||||
} else {
|
||||
ret = afe_set_lpass_clk_cfg(index, cfg);
|
||||
}
|
||||
|
|
@ -12055,8 +12063,6 @@ int afe_vote_lpass_core_hw(uint32_t hw_block_id, char *client_name,
|
|||
pr_debug("%s: lpass core hw vote opcode[0x%x] hw id[0x%x]\n",
|
||||
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
|
||||
|
||||
trace_printk("%s: lpass core hw vote opcode[0x%x] hw id[0x%x]\n",
|
||||
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
|
||||
*client_handle = 0;
|
||||
|
||||
ret = afe_apr_send_clk_pkt((uint32_t *)cmd_ptr,
|
||||
|
|
@ -12096,7 +12102,6 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
|
|||
|
||||
if (!this_afe.lpass_hw_core_client_hdl[hw_block_id]) {
|
||||
pr_debug("%s: SSR in progress, return\n", __func__);
|
||||
trace_printk("%s: SSR in progress, return\n", __func__);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -12116,9 +12121,6 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
|
|||
pr_debug("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
|
||||
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
|
||||
|
||||
trace_printk("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
|
||||
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
|
||||
|
||||
if (cmd_ptr->client_handle <= 0) {
|
||||
pr_err("%s: invalid client handle\n", __func__);
|
||||
ret = -EINVAL;
|
||||
|
|
@ -12190,3 +12192,102 @@ void afe_set_lsm_afe_port_id(int idx, int lsm_port)
|
|||
this_afe.lsm_afe_ports[idx] = lsm_port;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_set_lsm_afe_port_id);
|
||||
|
||||
//Paired Rx Functions
|
||||
void afe_tdm_paired_rx_cfg_val(int intf_idx, int afe_port_id,
|
||||
union afe_port_group_config tdm_group,
|
||||
struct afe_tdm_port_config tdm_port,
|
||||
struct afe_param_id_tdm_lane_cfg tdm_lane)
|
||||
{
|
||||
afe_tdm_paired_rx_cfg[intf_idx].afe_port_id = afe_port_id;
|
||||
afe_tdm_paired_rx_cfg[intf_idx].tdm_port = tdm_port;
|
||||
afe_tdm_paired_rx_cfg[intf_idx].tdm_group = tdm_group;
|
||||
afe_tdm_paired_rx_cfg[intf_idx].tdm_lane = tdm_lane;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_tdm_paired_rx_cfg_val);
|
||||
|
||||
int afe_paired_rx_tdm_port_ops(int intf_idx, bool enable, atomic_t *dai_group_ref)
|
||||
{
|
||||
int rc = 0;
|
||||
int group_id = afe_tdm_paired_rx_cfg[intf_idx].tdm_group.group_cfg.group_id;
|
||||
int port_id = afe_tdm_paired_rx_cfg[intf_idx].afe_port_id;
|
||||
int group_idx = AFE_TDM_RX_GET_GROUP_IDX(group_id);
|
||||
atomic_t *group_ref = &dai_group_ref[group_idx];
|
||||
atomic_t *port_ref = NULL;
|
||||
int index = 0;
|
||||
|
||||
if (port_id == 0) {
|
||||
pr_debug("%s:No Paired Rx alloted for TDM interface %d", __func__, intf_idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
index = q6audio_get_port_index(port_id);
|
||||
if (index < 0 || index >= AFE_MAX_PORTS) {
|
||||
pr_err("%s: AFE port index[%d] invalid!\n",
|
||||
__func__, index);
|
||||
return -EINVAL;
|
||||
}
|
||||
port_ref = &afe_tdm_port_ref[index];
|
||||
if (enable) {
|
||||
pr_debug("%s:Paired Rx Afe Port Id 0x%x Start, Group Id is 0x%x", __func__, port_id, group_id);
|
||||
if (atomic_read(group_ref) == 0) {
|
||||
rc = afe_port_group_enable(group_id,
|
||||
&afe_tdm_paired_rx_cfg[intf_idx].tdm_group,
|
||||
true,
|
||||
&afe_tdm_paired_rx_cfg[intf_idx].tdm_lane);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:Failed to enable paired rx afe group 0x%x\n"
|
||||
, __func__, group_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (atomic_read(port_ref) == 0){
|
||||
rc = afe_tdm_port_start(port_id,
|
||||
&afe_tdm_paired_rx_cfg[intf_idx].tdm_port,
|
||||
afe_tdm_paired_rx_cfg[intf_idx].tdm_port.tdm.sample_rate,
|
||||
afe_tdm_paired_rx_cfg[intf_idx].tdm_port.tdm.num_channels);
|
||||
if (rc < 0) {
|
||||
if (atomic_read(group_ref) == 0) {
|
||||
afe_port_group_enable(group_id,
|
||||
NULL, false, NULL);
|
||||
}
|
||||
pr_err("%s: fail to open paired rx AFE port 0x%x\n", __func__, port_id);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
pr_debug("%s:Paired Rx Port Started Sucessfully", __func__);
|
||||
atomic_inc(group_ref);
|
||||
}
|
||||
} else {
|
||||
pr_debug("%s:Paired Rx Usecase already started", __func__);
|
||||
atomic_inc(port_ref);
|
||||
atomic_inc(group_ref);
|
||||
}
|
||||
} else {
|
||||
pr_debug("%s:Paired Rx Afe Port Id 0x%x Stop, Group Id is 0x%x", __func__, port_id, group_id);
|
||||
if (atomic_read(port_ref) == 1) {
|
||||
rc = afe_close(port_id);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:Failed to close paired rx port 0x%x", __func__, port_id);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
pr_debug("%s:Paired Rx Usecase closed successfully", __func__);
|
||||
}
|
||||
atomic_dec(group_ref);
|
||||
if (atomic_read(group_ref) == 0) {
|
||||
rc = afe_port_group_enable(group_id, NULL, false, NULL);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: fail to disable paired AFE group 0x%x\n", __func__, group_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
} else if (atomic_read(port_ref) > 1) {
|
||||
atomic_dec(port_ref);
|
||||
atomic_dec(group_ref);
|
||||
} else {
|
||||
pr_err("%s:No need to close port",__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_paired_rx_tdm_port_ops);
|
||||
|
|
|
|||
|
|
@ -8526,10 +8526,11 @@ static int voice_alloc_oob_shared_mem(void)
|
|||
bufsz * bufcnt,
|
||||
&phys, &len,
|
||||
&mem_addr);
|
||||
if (rc < 0) {
|
||||
if (rc) {
|
||||
pr_err("%s: audio ION alloc failed, rc = %d\n",
|
||||
__func__, rc);
|
||||
|
||||
rc = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -8578,10 +8579,11 @@ static int voice_alloc_oob_mem_table(void)
|
|||
&v->shmem_info.memtbl.phys,
|
||||
&len,
|
||||
&(v->shmem_info.memtbl.data));
|
||||
if (rc < 0) {
|
||||
if (rc) {
|
||||
pr_err("%s: audio ION alloc failed, rc = %d\n",
|
||||
__func__, rc);
|
||||
|
||||
rc = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -8964,9 +8966,10 @@ static int voice_alloc_cal_mem_map_table(void)
|
|||
&common.cal_mem_map_table.phys,
|
||||
&len,
|
||||
&(common.cal_mem_map_table.data));
|
||||
if ((ret < 0) && (ret != -EPROBE_DEFER)) {
|
||||
if ((ret) && (ret != -EPROBE_DEFER)) {
|
||||
pr_err("%s: audio ION alloc failed, rc = %d\n",
|
||||
__func__, ret);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -8990,9 +8993,10 @@ static int voice_alloc_rtac_mem_map_table(void)
|
|||
&common.rtac_mem_map_table.phys,
|
||||
&len,
|
||||
&(common.rtac_mem_map_table.data));
|
||||
if (ret < 0) {
|
||||
if (ret) {
|
||||
pr_err("%s: audio ION alloc failed, rc = %d\n",
|
||||
__func__, ret);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -9722,7 +9726,7 @@ static int voice_alloc_source_tracking_shared_memory(void)
|
|||
&(common.source_tracking_sh_mem.sh_mem_block.phys),
|
||||
(size_t *)&(common.source_tracking_sh_mem.sh_mem_block.size),
|
||||
&(common.source_tracking_sh_mem.sh_mem_block.data));
|
||||
if (ret < 0) {
|
||||
if (ret) {
|
||||
pr_err("%s: audio ION alloc failed for sh_mem block, ret = %d\n",
|
||||
__func__, ret);
|
||||
|
||||
|
|
@ -9744,7 +9748,7 @@ static int voice_alloc_source_tracking_shared_memory(void)
|
|||
&(common.source_tracking_sh_mem.sh_mem_table.phys),
|
||||
(size_t *)&(common.source_tracking_sh_mem.sh_mem_table.size),
|
||||
&(common.source_tracking_sh_mem.sh_mem_table.data));
|
||||
if (ret < 0) {
|
||||
if (ret) {
|
||||
pr_err("%s: audio ION alloc failed for sh_mem table, ret = %d\n",
|
||||
__func__, ret);
|
||||
|
||||
|
|
|
|||
|
|
@ -159,9 +159,10 @@ int rtac_allocate_cal_buffer(uint32_t cal_type)
|
|||
&rtac_cal[cal_type].cal_data.paddr,
|
||||
&len,
|
||||
&rtac_cal[cal_type].cal_data.kvaddr);
|
||||
if (result < 0) {
|
||||
if (result) {
|
||||
pr_err("%s: ION create client for RTAC failed\n",
|
||||
__func__);
|
||||
result = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
|||
32
techpack/audio/include/dsp/apr_audio-v2.h
Normal file → Executable file
32
techpack/audio/include/dsp/apr_audio-v2.h
Normal file → Executable file
|
|
@ -846,6 +846,10 @@ struct audproc_softvolume_params {
|
|||
*/
|
||||
#define AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT 0x00010913
|
||||
|
||||
/* ID of the Output Media Format V2 parameters used by AUDPROC_MODULE_ID_MFC.
|
||||
*/
|
||||
#define AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT_V2 0x00010942
|
||||
|
||||
/* Param ID of Channel Mixer used by AUDPROC_MODULE_ID_MFC */
|
||||
#define AUDPROC_CHMIXER_PARAM_ID_COEFF 0x00010342
|
||||
|
||||
|
|
@ -881,6 +885,33 @@ struct adm_cmd_set_pp_params_v5 {
|
|||
*/
|
||||
} __packed;
|
||||
|
||||
/* Payload of the AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT_V2 parameter in the
|
||||
Media Format Converter Module. Following this will be the variable payload for channel_map.
|
||||
*/
|
||||
struct audproc_mfc_output_media_fmt_v2_t
|
||||
{
|
||||
uint32_t sampling_rate;
|
||||
/**< @h2xmle_description {Sampling rate in samples per second.}
|
||||
@h2xmle_range {0..384000} */
|
||||
|
||||
uint16_t bits_per_sample;
|
||||
/**< @h2xmle_description {Number of bits used to store each sample.}
|
||||
@h2xmle_rangeList {"16 bits per sample (Q15 format)"= 16;"24 bits per sample (Q27 format)"=24;"32 bits per sample (Q31 format)"=32
|
||||
@h2xmle_default {16}
|
||||
*/
|
||||
|
||||
uint16_t num_channels;
|
||||
/**< @h2xmle_description {Number of channels.}
|
||||
@h2xmle_default {1}
|
||||
@h2xmle_range {1..32} */
|
||||
|
||||
uint16_t channel_type[0];
|
||||
/**< @h2xmle_description {Channel mapping array. Specify a channel mapping for each output channel.If the number of channels is not a multiple of four, zero padding must be added to the channel type array to align the packet to a multiple of 32 bits.}
|
||||
@h2xmle_variableArraySize {num_channels}
|
||||
@h2xmle_range {1..63}
|
||||
@h2xmle_default {1}*/
|
||||
} __packed;
|
||||
|
||||
/* Maximum number of channels supported by MFC media fmt params */
|
||||
#define AUDPROC_MFC_OUT_CHANNELS_MAX 8
|
||||
|
||||
|
|
@ -5716,6 +5747,7 @@ struct afe_param_id_lpass_core_shared_clk_cfg {
|
|||
|
||||
#define NULL_POPP_TOPOLOGY 0x00010C68
|
||||
#define NULL_COPP_TOPOLOGY 0x00010312
|
||||
#define AUDIO_COPP_MFC 0x10000098
|
||||
#define DEFAULT_COPP_TOPOLOGY 0x00010314
|
||||
#define DEFAULT_POPP_TOPOLOGY 0x00010BE4
|
||||
#define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY 0x0001076B
|
||||
|
|
|
|||
|
|
@ -63,8 +63,16 @@
|
|||
#define BAP_BROADCAST 2
|
||||
#define BAP_BA_SIMULCAST 3
|
||||
|
||||
#define AFE_TDM_INTERFACE_MAX 10
|
||||
#define AFE_ID_MASK 0xFF
|
||||
#define AFE_ID_SHIFT 4
|
||||
#define PORT_ID_TO_INTF_IDX(b) ((b & AFE_ID_MASK) >> AFE_ID_SHIFT)
|
||||
#define AFE_TDM_RX_GET_GROUP_IDX(b) ((PORT_ID_TO_INTF_IDX(b)) * 2)
|
||||
#define AFE_TDM_TX_GET_GROUP_IDX(b) ((PORT_ID_TO_INTF_IDX(b)) * 2 + 1)
|
||||
#define MAX_PORTS_PER_INTF 8
|
||||
|
||||
typedef int (*routing_cb)(int port);
|
||||
u16 num_of_bits_set(u16 sd_line_mask);
|
||||
|
||||
enum {
|
||||
/* IDX 0->4 */
|
||||
|
|
@ -678,4 +686,15 @@ int afe_get_spk_v_vali_flag(void);
|
|||
void afe_get_spk_v_vali_sts(int *spk_v_vali_sts);
|
||||
void afe_set_spk_initial_cal(int initial_cal);
|
||||
void afe_set_spk_v_vali_flag(int v_vali_flag);
|
||||
struct afe_tdm_intf_paired_rx_cfg {
|
||||
int afe_port_id;
|
||||
union afe_port_group_config tdm_group; /* hold tdm group config */
|
||||
struct afe_tdm_port_config tdm_port; /* hold tdm config */
|
||||
struct afe_param_id_tdm_lane_cfg tdm_lane; /* hold tdm lane config */
|
||||
};
|
||||
void afe_tdm_paired_rx_cfg_val(int intf_idx, int afe_port_id,
|
||||
union afe_port_group_config tdm_group, struct afe_tdm_port_config tdm_port,
|
||||
struct afe_param_id_tdm_lane_cfg tdm_lane);
|
||||
int afe_paired_rx_tdm_port_ops(int intf_idx, bool enable, atomic_t *dai_group_ref);
|
||||
|
||||
#endif /* __Q6AFE_V2_H__ */
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -265,12 +266,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;
|
||||
}
|
||||
|
||||
|
|
@ -517,7 +520,6 @@ int lpi_pinctrl_suspend(struct device *dev)
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
trace_printk("%s: system suspend\n", __func__);
|
||||
dev_dbg(dev, "%s: system suspend\n", __func__);
|
||||
|
||||
if ((!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev))) {
|
||||
|
|
@ -554,7 +556,6 @@ static struct notifier_block service_nb = {
|
|||
|
||||
static void lpi_pinctrl_ssr_disable(struct device *dev, void *data)
|
||||
{
|
||||
trace_printk("%s: enter\n", __func__);
|
||||
lpi_dev_up = false;
|
||||
lpi_pinctrl_suspend(dev);
|
||||
}
|
||||
|
|
@ -879,7 +880,6 @@ int lpi_pinctrl_runtime_resume(struct device *dev)
|
|||
int ret = 0;
|
||||
struct clk *hw_vote = state->lpass_core_hw_vote;
|
||||
|
||||
trace_printk("%s: enter\n", __func__);
|
||||
if (state->lpass_core_hw_vote == NULL) {
|
||||
dev_dbg(dev, "%s: Invalid core hw node\n", __func__);
|
||||
if (state->lpass_audio_hw_vote == NULL) {
|
||||
|
|
@ -905,7 +905,6 @@ int lpi_pinctrl_runtime_resume(struct device *dev)
|
|||
|
||||
exit:
|
||||
mutex_unlock(&state->core_hw_vote_lock);
|
||||
trace_printk("%s: exit\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -914,7 +913,6 @@ int lpi_pinctrl_runtime_suspend(struct device *dev)
|
|||
struct lpi_gpio_state *state = dev_get_drvdata(dev);
|
||||
struct clk *hw_vote = state->lpass_core_hw_vote;
|
||||
|
||||
trace_printk("%s: enter\n", __func__);
|
||||
if (state->lpass_core_hw_vote == NULL) {
|
||||
dev_dbg(dev, "%s: Invalid core hw node\n", __func__);
|
||||
if (state->lpass_audio_hw_vote == NULL) {
|
||||
|
|
@ -930,7 +928,6 @@ int lpi_pinctrl_runtime_suspend(struct device *dev)
|
|||
state->core_hw_vote_status = false;
|
||||
}
|
||||
mutex_unlock(&state->core_hw_vote_lock);
|
||||
trace_printk("%s: exit\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
|
|
@ -233,6 +234,9 @@ int snd_event_client_deregister(struct device *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "%s: removing client to SND event FW \n",
|
||||
__func__);
|
||||
|
||||
mutex_lock(&snd_event_mutex);
|
||||
if (list_empty(&snd_event_client_list)) {
|
||||
dev_dbg(dev, "%s: No SND client registered\n", __func__);
|
||||
|
|
@ -249,7 +253,7 @@ int snd_event_client_deregister(struct device *dev)
|
|||
|
||||
c->state = false;
|
||||
|
||||
if (master && master->clients_found) {
|
||||
if (master) {
|
||||
struct snd_event_client *d;
|
||||
bool dev_found = false;
|
||||
|
||||
|
|
@ -260,9 +264,12 @@ int snd_event_client_deregister(struct device *dev)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (dev_found) {
|
||||
ret = check_and_update_fwk_state();
|
||||
master->clients_found = false;
|
||||
if (dev_found ) {
|
||||
if(master->clients_found) {
|
||||
ret = check_and_update_fwk_state();
|
||||
master->clients_found = false;
|
||||
}
|
||||
master->clients->cl_arr[i].dev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,6 +311,8 @@ void snd_event_mstr_add_client(struct snd_event_clients **snd_clients,
|
|||
GFP_KERNEL);
|
||||
if (!client->cl_arr) {
|
||||
*snd_clients = ERR_PTR(-ENOMEM);
|
||||
kfree(client);
|
||||
client = NULL;
|
||||
return;
|
||||
}
|
||||
*snd_clients = client;
|
||||
|
|
@ -463,6 +472,9 @@ int snd_event_notify(struct device *dev, unsigned int state)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "%s: snd_event_notify (state %u)\n",
|
||||
__func__, state);
|
||||
|
||||
mutex_lock(&snd_event_mutex);
|
||||
if (list_empty(&snd_event_client_list) && !master) {
|
||||
dev_err(dev, "%s: No device registered\n", __func__);
|
||||
|
|
|
|||
|
|
@ -421,8 +421,6 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
|
|||
if (!swrm->dev_up) {
|
||||
dev_dbg(swrm->dev, "%s: device is down or SSR state\n",
|
||||
__func__);
|
||||
trace_printk("%s: device is down or SSR state\n",
|
||||
__func__);
|
||||
mutex_unlock(&swrm->devlock);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
@ -453,8 +451,6 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
|
|||
if (!swrm->dev_up) {
|
||||
dev_dbg(swrm->dev, "%s: device is down or SSR state\n",
|
||||
__func__);
|
||||
trace_printk("%s: device is down or SSR state\n",
|
||||
__func__);
|
||||
mutex_unlock(&swrm->devlock);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
@ -483,8 +479,6 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
|
|||
mutex_unlock(&swrm->devlock);
|
||||
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -550,8 +544,6 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
|
|||
}
|
||||
swrm->clk_ref_count++;
|
||||
if (swrm->clk_ref_count == 1) {
|
||||
trace_printk("%s: clock enable count %d",
|
||||
__func__, swrm->clk_ref_count);
|
||||
ret = swrm->clk(swrm->handle, true);
|
||||
if (ret) {
|
||||
dev_err_ratelimited(swrm->dev,
|
||||
|
|
@ -561,8 +553,6 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
|
|||
}
|
||||
}
|
||||
} else if (--swrm->clk_ref_count == 0) {
|
||||
trace_printk("%s: clock disable count %d",
|
||||
__func__, swrm->clk_ref_count);
|
||||
swrm->clk(swrm->handle, false);
|
||||
complete(&swrm->clk_off_complete);
|
||||
}
|
||||
|
|
@ -984,6 +974,7 @@ static int swrm_cmd_fifo_wr_cmd(struct swr_mstr_ctrl *swrm, u8 cmd_data,
|
|||
* Check for outstanding cmd wrt. write fifo depth to avoid
|
||||
* overflow.
|
||||
*/
|
||||
usleep_range(500, 550);
|
||||
swrm_wait_for_fifo_avail(swrm, SWRM_WR_CHECK_AVAIL);
|
||||
swr_master_write(swrm, SWRM_CMD_FIFO_WR_CMD, val);
|
||||
/*
|
||||
|
|
@ -2010,7 +2001,6 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
|
|||
struct swr_master *mstr = &swrm->master;
|
||||
int retry = 5;
|
||||
|
||||
trace_printk("%s enter\n", __func__);
|
||||
if (unlikely(swrm_lock_sleep(swrm) == false)) {
|
||||
dev_err(swrm->dev, "%s Failed to hold suspend\n", __func__);
|
||||
return IRQ_NONE;
|
||||
|
|
@ -2037,7 +2027,6 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
|
|||
intr_sts_masked = intr_sts & swrm->intr_mask;
|
||||
|
||||
dev_dbg(swrm->dev, "%s: status: 0x%x \n", __func__, intr_sts_masked);
|
||||
trace_printk("%s: status: 0x%x \n", __func__, intr_sts_masked);
|
||||
handle_irq:
|
||||
for (i = 0; i < SWRM_INTERRUPT_MAX; i++) {
|
||||
value = intr_sts_masked & (1 << i);
|
||||
|
|
@ -2254,7 +2243,6 @@ err_audio_hw_vote:
|
|||
exit:
|
||||
mutex_unlock(&swrm->reslock);
|
||||
swrm_unlock_sleep(swrm);
|
||||
trace_printk("%s exit\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2268,7 +2256,6 @@ static irqreturn_t swrm_wakeup_interrupt(int irq, void *dev)
|
|||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
trace_printk("%s enter\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
if (swrm->state == SWR_MSTR_SSR || !swrm->dev_up) {
|
||||
if (swrm->wake_irq > 0) {
|
||||
|
|
@ -2307,7 +2294,6 @@ static irqreturn_t swrm_wakeup_interrupt(int irq, void *dev)
|
|||
pm_runtime_put_autosuspend(swrm->dev);
|
||||
swrm_unlock_sleep(swrm);
|
||||
exit:
|
||||
trace_printk("%s exit\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2322,7 +2308,6 @@ static void swrm_wakeup_work(struct work_struct *work)
|
|||
return;
|
||||
}
|
||||
|
||||
trace_printk("%s enter\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
if (!swrm->dev_up) {
|
||||
mutex_unlock(&swrm->devlock);
|
||||
|
|
@ -2338,7 +2323,6 @@ static void swrm_wakeup_work(struct work_struct *work)
|
|||
pm_runtime_put_autosuspend(swrm->dev);
|
||||
swrm_unlock_sleep(swrm);
|
||||
exit:
|
||||
trace_printk("%s exit\n", __func__);
|
||||
pm_relax(swrm->dev);
|
||||
}
|
||||
|
||||
|
|
@ -3106,8 +3090,6 @@ static int swrm_runtime_resume(struct device *dev)
|
|||
|
||||
dev_dbg(dev, "%s: pm_runtime: resume, state:%d\n",
|
||||
__func__, swrm->state);
|
||||
trace_printk("%s: pm_runtime: resume, state:%d\n",
|
||||
__func__, swrm->state);
|
||||
mutex_lock(&swrm->reslock);
|
||||
|
||||
if (swrm_request_hw_vote(swrm, LPASS_HW_CORE, true)) {
|
||||
|
|
@ -3164,9 +3146,6 @@ static int swrm_runtime_resume(struct device *dev)
|
|||
dev_dbg(dev,
|
||||
"%s slave device up not implemented\n",
|
||||
__func__);
|
||||
trace_printk(
|
||||
"%s slave device up not implemented\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
} else if (ret) {
|
||||
dev_err(dev,
|
||||
|
|
@ -3231,8 +3210,6 @@ exit:
|
|||
swrm->req_clk_switch = false;
|
||||
mutex_unlock(&swrm->reslock);
|
||||
|
||||
trace_printk("%s: pm_runtime: resume done, state:%d\n",
|
||||
__func__, swrm->state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -3247,8 +3224,6 @@ static int swrm_runtime_suspend(struct device *dev)
|
|||
int current_state = 0;
|
||||
struct irq_data *irq_data = NULL;
|
||||
|
||||
trace_printk("%s: pm_runtime: suspend state: %d\n",
|
||||
__func__, swrm->state);
|
||||
dev_dbg(dev, "%s: pm_runtime: suspend state: %d\n",
|
||||
__func__, swrm->state);
|
||||
if (swrm->state == SWR_MSTR_SSR_RESET) {
|
||||
|
|
@ -3274,7 +3249,6 @@ static int swrm_runtime_suspend(struct device *dev)
|
|||
if ((current_state != SWR_MSTR_SSR) &&
|
||||
swrm_is_port_en(&swrm->master)) {
|
||||
dev_dbg(dev, "%s ports are enabled\n", __func__);
|
||||
trace_printk("%s ports are enabled\n", __func__);
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
|
@ -3292,22 +3266,14 @@ static int swrm_runtime_suspend(struct device *dev)
|
|||
dev_dbg_ratelimited(dev,
|
||||
"%s slave device down not implemented\n",
|
||||
__func__);
|
||||
trace_printk(
|
||||
"%s slave device down not implemented\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
} else if (ret) {
|
||||
dev_err(dev,
|
||||
"%s: failed to shutdown swr dev %d\n",
|
||||
__func__, swr_dev->dev_num);
|
||||
trace_printk(
|
||||
"%s: failed to shutdown swr dev %d\n",
|
||||
__func__, swr_dev->dev_num);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
trace_printk("%s: clk stop mode not supported or SSR exit\n",
|
||||
__func__);
|
||||
} else {
|
||||
/* Mask bus clash interrupt */
|
||||
swrm->intr_mask &= ~((u32)0x08);
|
||||
|
|
@ -3361,8 +3327,6 @@ exit:
|
|||
if (!hw_core_err)
|
||||
swrm_request_hw_vote(swrm, LPASS_HW_CORE, false);
|
||||
mutex_unlock(&swrm->reslock);
|
||||
trace_printk("%s: pm_runtime: suspend done state: %d\n",
|
||||
__func__, swrm->state);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
|
@ -3374,7 +3338,6 @@ static int swrm_device_suspend(struct device *dev)
|
|||
int ret = 0;
|
||||
|
||||
dev_dbg(dev, "%s: swrm state: %d\n", __func__, swrm->state);
|
||||
trace_printk("%s: swrm state: %d\n", __func__, swrm->state);
|
||||
if (!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev)) {
|
||||
ret = swrm_runtime_suspend(dev);
|
||||
if (!ret) {
|
||||
|
|
@ -3393,7 +3356,6 @@ static int swrm_device_down(struct device *dev)
|
|||
struct swr_mstr_ctrl *swrm = platform_get_drvdata(pdev);
|
||||
|
||||
dev_dbg(dev, "%s: swrm state: %d\n", __func__, swrm->state);
|
||||
trace_printk("%s: swrm state: %d\n", __func__, swrm->state);
|
||||
|
||||
mutex_lock(&swrm->force_down_lock);
|
||||
swrm->state = SWR_MSTR_SSR;
|
||||
|
|
@ -3571,7 +3533,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
|||
}
|
||||
break;
|
||||
case SWR_DEVICE_SSR_DOWN:
|
||||
trace_printk("%s: swr device down called\n", __func__);
|
||||
mutex_lock(&swrm->mlock);
|
||||
if (swrm->state == SWR_MSTR_DOWN)
|
||||
dev_dbg(swrm->dev, "%s:SWR master is already Down:%d\n",
|
||||
|
|
@ -3590,7 +3551,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
|||
break;
|
||||
case SWR_DEVICE_SSR_UP:
|
||||
/* wait for clk voting to be zero */
|
||||
trace_printk("%s: swr device up called\n", __func__);
|
||||
reinit_completion(&swrm->clk_off_complete);
|
||||
if (swrm->clk_ref_count &&
|
||||
!wait_for_completion_timeout(&swrm->clk_off_complete,
|
||||
|
|
@ -3616,7 +3576,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
|||
break;
|
||||
case SWR_DEVICE_DOWN:
|
||||
dev_dbg(swrm->dev, "%s: swr master down called\n", __func__);
|
||||
trace_printk("%s: swr master down called\n", __func__);
|
||||
mutex_lock(&swrm->mlock);
|
||||
if (swrm->state == SWR_MSTR_DOWN)
|
||||
dev_dbg(swrm->dev, "%s:SWR master is already Down:%d\n",
|
||||
|
|
@ -3627,7 +3586,6 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
|||
break;
|
||||
case SWR_DEVICE_UP:
|
||||
dev_dbg(swrm->dev, "%s: swr master up called\n", __func__);
|
||||
trace_printk("%s: swr master up called\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
if (!swrm->dev_up) {
|
||||
dev_dbg(swrm->dev, "SSR not complete yet\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue