Merge "asoc: bolero: Ensure va-macro is registered before other macros"
diff --git a/asoc/codecs/bolero/tx-macro.c b/asoc/codecs/bolero/tx-macro.c
index 5934067..158f350 100644
--- a/asoc/codecs/bolero/tx-macro.c
+++ b/asoc/codecs/bolero/tx-macro.c
@@ -175,6 +175,7 @@
int dec_mode[NUM_DECIMATORS];
bool bcs_clk_en;
bool hs_slow_insert_complete;
+ int amic_sample_rate;
};
static bool tx_macro_get_data(struct snd_soc_component *component,
@@ -499,6 +500,29 @@
hpf_cut_off_freq << 5);
snd_soc_component_update_bits(component, hpf_gate_reg,
0x03, 0x02);
+ /* Add delay between toggle hpf gate based on sample rate */
+ switch(tx_priv->amic_sample_rate) {
+ case 8000:
+ usleep_range(125, 130);
+ break;
+ case 16000:
+ usleep_range(62, 65);
+ break;
+ case 32000:
+ usleep_range(31, 32);
+ break;
+ case 48000:
+ usleep_range(20, 21);
+ break;
+ case 96000:
+ usleep_range(10, 11);
+ break;
+ case 192000:
+ usleep_range(5, 6);
+ break;
+ default:
+ usleep_range(125, 130);
+ }
snd_soc_component_update_bits(component, hpf_gate_reg,
0x03, 0x01);
} else {
@@ -901,6 +925,7 @@
u16 dec_cfg_reg = 0;
u16 hpf_gate_reg = 0;
u16 tx_gain_ctl_reg = 0;
+ u16 tx_fs_reg = 0;
u8 hpf_cut_off_freq = 0;
int hpf_delay = TX_MACRO_DMIC_HPF_DELAY_MS;
int unmute_delay = TX_MACRO_DMIC_UNMUTE_DELAY_MS;
@@ -925,6 +950,11 @@
TX_MACRO_TX_PATH_OFFSET * decimator;
tx_gain_ctl_reg = BOLERO_CDC_TX0_TX_VOL_CTL +
TX_MACRO_TX_PATH_OFFSET * decimator;
+ tx_fs_reg = BOLERO_CDC_TX0_TX_PATH_CTL +
+ TX_MACRO_TX_PATH_OFFSET * decimator;
+
+ tx_priv->amic_sample_rate = (snd_soc_component_read32(component,
+ tx_fs_reg) & 0x0F);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
diff --git a/asoc/codecs/rouleur/rouleur-mbhc.c b/asoc/codecs/rouleur/rouleur-mbhc.c
index f0eea09..c7ba03c 100644
--- a/asoc/codecs/rouleur/rouleur-mbhc.c
+++ b/asoc/codecs/rouleur/rouleur-mbhc.c
@@ -33,8 +33,8 @@
#define ROULEUR_ZDET_C3 4500
/* Cross connection thresholds in mV */
-#define ROULEUR_HPHL_CROSS_CONN_THRESHOLD 200
-#define ROULEUR_HPHR_CROSS_CONN_THRESHOLD 200
+#define ROULEUR_HPHL_CROSS_CONN_THRESHOLD 350
+#define ROULEUR_HPHR_CROSS_CONN_THRESHOLD 350
static struct wcd_mbhc_register
wcd_mbhc_registers[WCD_MBHC_REG_FUNC_MAX] = {
diff --git a/asoc/codecs/wcd938x/wcd938x.c b/asoc/codecs/wcd938x/wcd938x.c
index 3f6292c..511fd1f 100644
--- a/asoc/codecs/wcd938x/wcd938x.c
+++ b/asoc/codecs/wcd938x/wcd938x.c
@@ -1591,69 +1591,6 @@
return ret;
}
-static int wcd938x_codec_enable_adc(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event){
- struct snd_soc_component *component =
- snd_soc_dapm_to_component(w->dapm);
- struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
- int clk_rate = 0;
-
- dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
- w->name, event);
-
- switch (event) {
- case SND_SOC_DAPM_PRE_PMU:
- snd_soc_component_update_bits(component,
- WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x08);
- snd_soc_component_update_bits(component,
- WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
- set_bit(w->shift, &wcd938x->status_mask);
- clk_rate = wcd938x_get_clk_rate(wcd938x->tx_mode[w->shift]);
- /* Enable BCS for Headset mic */
- if (w->shift == 1 && !(snd_soc_component_read32(component,
- WCD938X_TX_NEW_AMIC_MUX_CFG) & 0x80)) {
- if (!wcd938x->bcs_dis)
- wcd938x_tx_connect_port(component, MBHC,
- SWR_CLK_RATE_4P8MHZ, true);
- set_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
- }
- wcd938x_tx_connect_port(component, ADC1 + (w->shift), clk_rate,
- true);
- break;
- case SND_SOC_DAPM_POST_PMD:
- wcd938x_tx_connect_port(component, ADC1 + (w->shift), 0, false);
- if (w->shift == 1 &&
- test_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask)) {
- if (!wcd938x->bcs_dis)
- wcd938x_tx_connect_port(component, MBHC, 0,
- false);
- clear_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
- }
- snd_soc_component_update_bits(component,
- WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x00);
- clear_bit(w->shift, &wcd938x->status_mask);
- break;
- };
-
- return 0;
-}
-
-void wcd938x_disable_bcs_before_slow_insert(struct snd_soc_component *component,
- bool bcs_disable)
-{
- struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
-
- if (wcd938x->update_wcd_event) {
- if (bcs_disable)
- wcd938x->update_wcd_event(wcd938x->handle,
- WCD_BOLERO_EVT_BCS_CLK_OFF, 0);
- else
- wcd938x->update_wcd_event(wcd938x->handle,
- WCD_BOLERO_EVT_BCS_CLK_OFF, 1);
- }
-}
-
int wcd938x_tx_channel_config(struct snd_soc_component *component,
int channel, int mode)
{
@@ -1694,14 +1631,14 @@
return ret;
}
-static int wcd938x_enable_req(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event)
-{
+static int wcd938x_codec_enable_adc(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol,
+ int event){
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
- int mode;
- int ret = 0;
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
+ int clk_rate = 0, mode;
+ int ret = 0;
dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
w->name, event);
@@ -1709,9 +1646,21 @@
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_component_update_bits(component,
- WCD938X_DIGITAL_CDC_REQ_CTL, 0x02, 0x02);
+ WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x08);
snd_soc_component_update_bits(component,
- WCD938X_DIGITAL_CDC_REQ_CTL, 0x01, 0x00);
+ WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x10);
+ set_bit(w->shift, &wcd938x->status_mask);
+ clk_rate = wcd938x_get_clk_rate(wcd938x->tx_mode[w->shift]);
+ /* Enable BCS for Headset mic */
+ if (w->shift == 1 && !(snd_soc_component_read32(component,
+ WCD938X_TX_NEW_AMIC_MUX_CFG) & 0x80)) {
+ if (!wcd938x->bcs_dis)
+ wcd938x_tx_connect_port(component, MBHC,
+ SWR_CLK_RATE_4P8MHZ, true);
+ set_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
+ }
+ wcd938x_tx_connect_port(component, ADC1 + (w->shift), clk_rate,
+ true);
ret = wcd938x_tx_channel_config(component, w->shift, 1);
mode = wcd938x_get_adc_mode(wcd938x->tx_mode[w->shift]);
if (mode < 0) {
@@ -1787,6 +1736,56 @@
default:
break;
}
+ wcd938x_tx_connect_port(component, ADC1 + (w->shift), 0, false);
+ if (w->shift == 1 &&
+ test_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask)) {
+ if (!wcd938x->bcs_dis)
+ wcd938x_tx_connect_port(component, MBHC, 0,
+ false);
+ clear_bit(AMIC2_BCS_ENABLE, &wcd938x->status_mask);
+ }
+ snd_soc_component_update_bits(component,
+ WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x08, 0x00);
+ clear_bit(w->shift, &wcd938x->status_mask);
+ break;
+ };
+
+ return 0;
+}
+
+void wcd938x_disable_bcs_before_slow_insert(struct snd_soc_component *component,
+ bool bcs_disable)
+{
+ struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
+
+ if (wcd938x->update_wcd_event) {
+ if (bcs_disable)
+ wcd938x->update_wcd_event(wcd938x->handle,
+ WCD_BOLERO_EVT_BCS_CLK_OFF, 0);
+ else
+ wcd938x->update_wcd_event(wcd938x->handle,
+ WCD_BOLERO_EVT_BCS_CLK_OFF, 1);
+ }
+}
+
+static int wcd938x_enable_req(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
+ snd_soc_dapm_to_component(w->dapm);
+ int ret = 0;
+
+ dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__,
+ w->name, event);
+
+ switch (event) {
+ case SND_SOC_DAPM_PRE_PMU:
+ snd_soc_component_update_bits(component,
+ WCD938X_DIGITAL_CDC_REQ_CTL, 0x02, 0x02);
+ snd_soc_component_update_bits(component,
+ WCD938X_DIGITAL_CDC_REQ_CTL, 0x01, 0x00);
+ break;
+ case SND_SOC_DAPM_POST_PMD:
snd_soc_component_update_bits(component,
WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x10, 0x00);
break;
diff --git a/asoc/codecs/wsa881x.c b/asoc/codecs/wsa881x.c
index 8850ea6..b23bc01 100644
--- a/asoc/codecs/wsa881x.c
+++ b/asoc/codecs/wsa881x.c
@@ -1077,6 +1077,9 @@
0x80, 0x00);
if (wsa881x->visense_enable) {
wsa881x_visense_adc_ctrl(component, DISABLE);
+ snd_soc_component_update_bits(component,
+ WSA881X_ADC_EN_SEL_IBAIS,
+ 0x07, 0x00);
wsa881x_visense_txfe_ctrl(component, DISABLE,
0x00, 0x01, 0x01);
}
diff --git a/dsp/adsp-loader.c b/dsp/adsp-loader.c
index 8316f00..e99d6a3 100644
--- a/dsp/adsp-loader.c
+++ b/dsp/adsp-loader.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (c) 2012-2014, 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014, 2017-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -333,6 +333,8 @@
int fw_name_size;
u32 adsp_var_idx = 0;
int ret = 0;
+ u32 adsp_fuse_not_supported = 0;
+ const char *adsp_fw_name;
ret = adsp_loader_init_sysfs(pdev);
if (ret != 0) {
@@ -344,15 +346,58 @@
/* get adsp variant idx */
cell = nvmem_cell_get(&pdev->dev, "adsp_variant");
if (IS_ERR_OR_NULL(cell)) {
- dev_dbg(&pdev->dev, "%s: FAILED to get nvmem cell \n", __func__);
+ dev_dbg(&pdev->dev, "%s: FAILED to get nvmem cell \n",
+ __func__);
+
+ /*
+ * When ADSP variant read from fuse register is not
+ * supported, check if image with different fw image
+ * name needs to be loaded
+ */
+ ret = of_property_read_u32(pdev->dev.of_node,
+ "adsp-fuse-not-supported",
+ &adsp_fuse_not_supported);
+ if (ret) {
+ dev_dbg(&pdev->dev,
+ "%s: adsp_fuse_not_supported prop not found",
+ __func__, ret);
+ goto wqueue;
+ }
+
+ if (adsp_fuse_not_supported) {
+ /* Read ADSP firmware image name */
+ ret = of_property_read_string(pdev->dev.of_node,
+ "adsp-fw-name",
+ &adsp_fw_name);
+ if (ret < 0) {
+ dev_dbg(&pdev->dev, "%s: unable to read fw-name\n",
+ __func__);
+ goto wqueue;
+ }
+
+ fw_name_size = strlen(adsp_fw_name) + 1;
+ priv->adsp_fw_name = devm_kzalloc(&pdev->dev,
+ fw_name_size,
+ GFP_KERNEL);
+ if (!priv->adsp_fw_name)
+ goto wqueue;
+ strlcpy(priv->adsp_fw_name, adsp_fw_name,
+ fw_name_size);
+ }
goto wqueue;
}
buf = nvmem_cell_read(cell, &len);
nvmem_cell_put(cell);
- if (IS_ERR_OR_NULL(buf) || len <= 0 || len > sizeof(u32)) {
+ if (IS_ERR_OR_NULL(buf)) {
dev_dbg(&pdev->dev, "%s: FAILED to read nvmem cell \n", __func__);
goto wqueue;
}
+ if (len <= 0 || len > sizeof(u32)) {
+ dev_dbg(&pdev->dev, "%s: nvmem cell length out of range: %d\n",
+ __func__, len);
+ kfree(buf);
+ goto wqueue;
+ }
memcpy(&adsp_var_idx, buf, len);
kfree(buf);
diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c
index 73439ee..beaaa26 100644
--- a/soc/swr-mstr-ctrl.c
+++ b/soc/swr-mstr-ctrl.c
@@ -2828,13 +2828,14 @@
swrm->reg_irq(swrm->handle, swr_mstr_interrupt,
swrm, SWR_IRQ_FREE);
} else if (swrm->irq) {
+ if (irq_get_irq_data(swrm->irq) != NULL)
+ irqd_set_trigger_type(
+ irq_get_irq_data(swrm->irq),
+ IRQ_TYPE_NONE);
+ if (swrm->swr_irq_wakeup_capable)
+ irq_set_irq_wake(swrm->irq, 0);
free_irq(swrm->irq, swrm);
- irqd_set_trigger_type(
- irq_get_irq_data(swrm->irq),
- IRQ_TYPE_NONE);
}
- if (swrm->swr_irq_wakeup_capable)
- irq_set_irq_wake(swrm->irq, 0);
err_irq_fail:
mutex_destroy(&swrm->irq_lock);
mutex_destroy(&swrm->mlock);
@@ -2858,15 +2859,16 @@
swrm->reg_irq(swrm->handle, swr_mstr_interrupt,
swrm, SWR_IRQ_FREE);
} else if (swrm->irq) {
+ if (irq_get_irq_data(swrm->irq) != NULL)
+ irqd_set_trigger_type(
+ irq_get_irq_data(swrm->irq),
+ IRQ_TYPE_NONE);
+ if (swrm->swr_irq_wakeup_capable)
+ irq_set_irq_wake(swrm->irq, 0);
free_irq(swrm->irq, swrm);
- irqd_set_trigger_type(
- irq_get_irq_data(swrm->irq),
- IRQ_TYPE_NONE);
} else if (swrm->wake_irq > 0) {
free_irq(swrm->wake_irq, swrm);
}
- if (swrm->swr_irq_wakeup_capable)
- irq_set_irq_wake(swrm->irq, 0);
cancel_work_sync(&swrm->wakeup_work);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);