aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/qcom-audio-dev.txt8
-rw-r--r--sound/soc/codecs/wcd9320.h53
-rw-r--r--sound/soc/codecs/wcd9330.h51
-rw-r--r--sound/soc/codecs/wcd9xxx-common.h53
-rw-r--r--sound/soc/codecs/wcd9xxx-resmgr.h3
-rw-r--r--sound/soc/msm/Kconfig1
-rw-r--r--sound/soc/msm/apq8084.c677
7 files changed, 548 insertions, 298 deletions
diff --git a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
index f6a686e3212..3e314fed47e 100644
--- a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
+++ b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
@@ -983,13 +983,17 @@ Example:
* APQ8084 ASoC Machine driver
Required properties:
-- compatible : "qcom,apq8084-audio-taiko"
+- compatible : "qcom,apq8084-audio-taiko" or "qcom,apq8084-audio-tomtom"
- qcom,model : The user-visible name of this sound card.
- qcom,audio-routing : A list of the connections between audio components.
Each entry is a pair of strings, the first being the connection's sink,
the second being the connection's source.
- qcom,taiko-mclk-clk-freq : Taiko mclk Freq in Hz. currently only 9600000Hz
- is supported.
+ is supported. This property is required when
+ compatible field is "qcom,apq8084-audio-taiko"
+- qcom,tomtom-mclk-clk-freq : TomTom mclk Freq in Hz. currently only 9600000Hz
+ is supported. This property is required when
+ compatible field is "qcom,apq8084-audio-tomtom"
- qcom,prim-auxpcm-gpio-clk : GPIO on which Primary AUXPCM clk signal is coming.
- qcom,prim-auxpcm-gpio-sync : GPIO on which Primary AUXPCM SYNC signal is coming.
- qcom,prim-auxpcm-gpio-din : GPIO on which Primary AUXPCM DIN signal is coming.
diff --git a/sound/soc/codecs/wcd9320.h b/sound/soc/codecs/wcd9320.h
index 5ab52001b55..6b0f1e4333d 100644
--- a/sound/soc/codecs/wcd9320.h
+++ b/sound/soc/codecs/wcd9320.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundation. 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
@@ -91,57 +91,6 @@ enum {
TAIKO_TX_MAX,
};
-struct mad_audio_header {
- u32 reserved[3];
- u32 num_reg_cfg;
-};
-
-struct mad_microphone_info {
- uint8_t input_microphone;
- uint8_t cycle_time;
- uint8_t settle_time;
- uint8_t padding;
-} __packed;
-
-struct mad_micbias_info {
- uint8_t micbias;
- uint8_t k_factor;
- uint8_t external_bypass_capacitor;
- uint8_t internal_biasing;
- uint8_t cfilter;
- uint8_t padding[3];
-} __packed;
-
-struct mad_rms_audio_beacon_info {
- uint8_t rms_omit_samples;
- uint8_t rms_comp_time;
- uint8_t detection_mechanism;
- uint8_t rms_diff_threshold;
- uint8_t rms_threshold_lsb;
- uint8_t rms_threshold_msb;
- uint8_t padding[2];
- uint8_t iir_coefficients[36];
-} __packed;
-
-struct mad_rms_ultrasound_info {
- uint8_t rms_comp_time;
- uint8_t detection_mechanism;
- uint8_t rms_diff_threshold;
- uint8_t rms_threshold_lsb;
- uint8_t rms_threshold_msb;
- uint8_t padding[3];
- uint8_t iir_coefficients[36];
-} __packed;
-
-struct mad_audio_cal {
- uint32_t version;
- struct mad_microphone_info microphone_info;
- struct mad_micbias_info micbias_info;
- struct mad_rms_audio_beacon_info audio_info;
- struct mad_rms_audio_beacon_info beacon_info;
- struct mad_rms_ultrasound_info ultrasound_info;
-} __packed;
-
extern int taiko_mclk_enable(struct snd_soc_codec *codec, int mclk_enable,
bool dapm);
extern int taiko_hs_detect(struct snd_soc_codec *codec,
diff --git a/sound/soc/codecs/wcd9330.h b/sound/soc/codecs/wcd9330.h
index d586ee37bde..200b7a9990e 100644
--- a/sound/soc/codecs/wcd9330.h
+++ b/sound/soc/codecs/wcd9330.h
@@ -99,57 +99,6 @@ enum {
TOMTOM_TX_MAX,
};
-struct mad_audio_header {
- u32 reserved[3];
- u32 num_reg_cfg;
-};
-
-struct mad_microphone_info {
- uint8_t input_microphone;
- uint8_t cycle_time;
- uint8_t settle_time;
- uint8_t padding;
-} __packed;
-
-struct mad_micbias_info {
- uint8_t micbias;
- uint8_t k_factor;
- uint8_t external_bypass_capacitor;
- uint8_t internal_biasing;
- uint8_t cfilter;
- uint8_t padding[3];
-} __packed;
-
-struct mad_rms_audio_beacon_info {
- uint8_t rms_omit_samples;
- uint8_t rms_comp_time;
- uint8_t detection_mechanism;
- uint8_t rms_diff_threshold;
- uint8_t rms_threshold_lsb;
- uint8_t rms_threshold_msb;
- uint8_t padding[2];
- uint8_t iir_coefficients[36];
-} __packed;
-
-struct mad_rms_ultrasound_info {
- uint8_t rms_comp_time;
- uint8_t detection_mechanism;
- uint8_t rms_diff_threshold;
- uint8_t rms_threshold_lsb;
- uint8_t rms_threshold_msb;
- uint8_t padding[3];
- uint8_t iir_coefficients[36];
-} __packed;
-
-struct mad_audio_cal {
- uint32_t version;
- struct mad_microphone_info microphone_info;
- struct mad_micbias_info micbias_info;
- struct mad_rms_audio_beacon_info audio_info;
- struct mad_rms_audio_beacon_info beacon_info;
- struct mad_rms_ultrasound_info ultrasound_info;
-} __packed;
-
extern int tomtom_mclk_enable(struct snd_soc_codec *codec, int mclk_enable,
bool dapm);
extern int tomtom_hs_detect(struct snd_soc_codec *codec,
diff --git a/sound/soc/codecs/wcd9xxx-common.h b/sound/soc/codecs/wcd9xxx-common.h
index 324f6e907e6..7826a47c848 100644
--- a/sound/soc/codecs/wcd9xxx-common.h
+++ b/sound/soc/codecs/wcd9xxx-common.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, The Linux Foundation. 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
@@ -91,6 +91,57 @@ enum wcd9xxx_buck_volt {
WCD9XXX_CDC_BUCK_MV_2P15 = 2150000,
};
+struct mad_audio_header {
+ u32 reserved[3];
+ u32 num_reg_cfg;
+};
+
+struct mad_microphone_info {
+ uint8_t input_microphone;
+ uint8_t cycle_time;
+ uint8_t settle_time;
+ uint8_t padding;
+} __packed;
+
+struct mad_micbias_info {
+ uint8_t micbias;
+ uint8_t k_factor;
+ uint8_t external_bypass_capacitor;
+ uint8_t internal_biasing;
+ uint8_t cfilter;
+ uint8_t padding[3];
+} __packed;
+
+struct mad_rms_audio_beacon_info {
+ uint8_t rms_omit_samples;
+ uint8_t rms_comp_time;
+ uint8_t detection_mechanism;
+ uint8_t rms_diff_threshold;
+ uint8_t rms_threshold_lsb;
+ uint8_t rms_threshold_msb;
+ uint8_t padding[2];
+ uint8_t iir_coefficients[36];
+} __packed;
+
+struct mad_rms_ultrasound_info {
+ uint8_t rms_comp_time;
+ uint8_t detection_mechanism;
+ uint8_t rms_diff_threshold;
+ uint8_t rms_threshold_lsb;
+ uint8_t rms_threshold_msb;
+ uint8_t padding[3];
+ uint8_t iir_coefficients[36];
+} __packed;
+
+struct mad_audio_cal {
+ uint32_t version;
+ struct mad_microphone_info microphone_info;
+ struct mad_micbias_info micbias_info;
+ struct mad_rms_audio_beacon_info audio_info;
+ struct mad_rms_audio_beacon_info beacon_info;
+ struct mad_rms_ultrasound_info ultrasound_info;
+} __packed;
+
extern void wcd9xxx_clsh_fsm(struct snd_soc_codec *codec,
struct wcd9xxx_clsh_cdc_data *cdc_clsh_d,
u8 req_state, bool req_type, u8 clsh_event);
diff --git a/sound/soc/codecs/wcd9xxx-resmgr.h b/sound/soc/codecs/wcd9xxx-resmgr.h
index 9f383b60314..a04f059079b 100644
--- a/sound/soc/codecs/wcd9xxx-resmgr.h
+++ b/sound/soc/codecs/wcd9xxx-resmgr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundation. 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
@@ -27,6 +27,7 @@ enum wcd9xxx_cdc_type {
WCD9XXX_CDC_TYPE_TAIKO,
WCD9XXX_CDC_TYPE_TAPAN,
WCD9XXX_CDC_TYPE_HELICON,
+ WCD9XXX_CDC_TYPE_TOMTOM,
};
enum wcd9xxx_clock_type {
diff --git a/sound/soc/msm/Kconfig b/sound/soc/msm/Kconfig
index eead06de1ea..f0a02d50a48 100644
--- a/sound/soc/msm/Kconfig
+++ b/sound/soc/msm/Kconfig
@@ -215,6 +215,7 @@ config SND_SOC_APQ8084
select SND_SOC_QDSP6V2
select SND_SOC_MSM_STUB
select SND_SOC_MSM_HOSTLESS_PCM
+ select SND_SOC_WCD9330
select SND_SOC_WCD9320
select SND_DYNAMIC_MINORS
select AUDIO_OCMEM
diff --git a/sound/soc/msm/apq8084.c b/sound/soc/msm/apq8084.c
index f86bbccb3f2..93355ab6a24 100644
--- a/sound/soc/msm/apq8084.c
+++ b/sound/soc/msm/apq8084.c
@@ -34,8 +34,9 @@
#include "qdsp6v2/q6core.h"
#include "../codecs/wcd9xxx-common.h"
#include "../codecs/wcd9320.h"
+#include "../codecs/wcd9330.h"
-#define DRV_NAME "apq8084-asoc-taiko"
+#define DRV_NAME "apq8084-asoc"
#define APQ8084_SPK_ON 1
@@ -112,7 +113,7 @@ static const struct soc_enum apq8084_auxpcm_enum[] = {
SOC_ENUM_SINGLE_EXT(2, auxpcm_rate_text),
};
-void *def_taiko_mbhc_cal(void);
+void *def_codec_mbhc_cal(void);
static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
int enable, bool dapm);
@@ -153,6 +154,18 @@ struct apq8084_asoc_mach_data {
struct msm_auxpcm_ctrl *sec_auxpcm_ctrl;
};
+struct apq8084_asoc_wcd93xx_codec {
+ int (*mclk_enable_fn) (struct snd_soc_codec *codec,
+ int mclk_enable, bool dapm);
+ void *(*get_afe_config_fn) (struct snd_soc_codec *codec,
+ enum afe_config_type config_type);
+ int (*mbhc_hs_detect) (struct snd_soc_codec *codec,
+ struct wcd9xxx_mbhc_config *mbhc_cfg);
+ void (*mbhc_hs_detect_exit) (struct snd_soc_codec *codec);
+};
+
+static struct apq8084_asoc_wcd93xx_codec apq8084_codec_fn;
+
#define GPIO_NAME_INDEX 0
#define DT_PARSE_INDEX 1
@@ -229,6 +242,7 @@ static int ext_mclk_gpio = -1;
static int clk_users;
static atomic_t prim_auxpcm_rsc_ref;
static atomic_t sec_auxpcm_rsc_ref;
+static bool codec_reg_done;
static int apq8084_liquid_ext_spk_power_amp_init(void)
{
@@ -611,6 +625,13 @@ static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
pr_debug("%s: enable = %d clk_users = %d\n",
__func__, enable, clk_users);
+
+ if (!apq8084_codec_fn.mclk_enable_fn) {
+ dev_err(codec->dev, "%s: codec mclk enable fn is not init'ed\n",
+ __func__);
+ return -EINVAL;
+ }
+
mutex_lock(&cdc_mclk_mutex);
if (enable) {
if (ext_mclk_gpio >= 0) {
@@ -619,16 +640,16 @@ static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
goto exit;
gpio_direction_output(ext_mclk_gpio, 1);
- taiko_mclk_enable(codec, 1, dapm);
+ apq8084_codec_fn.mclk_enable_fn(codec, 1, dapm);
} else if (codec_clk) {
clk_users++;
if (clk_users != 1)
goto exit;
clk_prepare_enable(codec_clk);
- taiko_mclk_enable(codec, 1, dapm);
+ apq8084_codec_fn.mclk_enable_fn(codec, 1, dapm);
} else {
- dev_err(codec->dev, "%s: did not get Taiko MCLK\n",
+ dev_err(codec->dev, "%s: did not get Codec MCLK\n",
__func__);
ret = -EINVAL;
goto exit;
@@ -637,14 +658,14 @@ static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
if (clk_users > 0) {
clk_users--;
if (clk_users == 0) {
- taiko_mclk_enable(codec, 0, dapm);
+ apq8084_codec_fn.mclk_enable_fn(codec, 0, dapm);
if (ext_mclk_gpio >= 0)
gpio_direction_output(ext_mclk_gpio, 0);
else if (codec_clk)
clk_disable_unprepare(codec_clk);
}
} else {
- pr_err("%s: Error releasing Taiko MCLK\n", __func__);
+ pr_err("%s: Error releasing Codec MCLK\n", __func__);
ret = -EINVAL;
goto exit;
}
@@ -1329,9 +1350,14 @@ static int msm_slim_5_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
pr_debug("%s enter\n", __func__);
+ if (!apq8084_codec_fn.get_afe_config_fn) {
+ pr_err("%s: codec get afe config not init'ed\n", __func__);
+ return -EINVAL;
+ }
rate->min = rate->max = 16000;
channels->min = channels->max = 1;
- config = taiko_get_afe_config(codec, AFE_SLIMBUS_SLAVE_PORT_CONFIG);
+ config = apq8084_codec_fn.get_afe_config_fn(codec,
+ AFE_SLIMBUS_SLAVE_PORT_CONFIG);
rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG, config,
SLIMBUS_5_TX);
if (rc) {
@@ -1528,14 +1554,23 @@ static int msm_afe_set_config(struct snd_soc_codec *codec)
void *config_data;
pr_debug("%s: enter\n", __func__);
- config_data = taiko_get_afe_config(codec, AFE_CDC_REGISTERS_CONFIG);
+
+ if (!apq8084_codec_fn.get_afe_config_fn) {
+ dev_err(codec->dev, "%s: codec get afe config not init'ed\n",
+ __func__);
+ return -EINVAL;
+ }
+
+ config_data = apq8084_codec_fn.get_afe_config_fn(codec,
+ AFE_CDC_REGISTERS_CONFIG);
rc = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
if (rc) {
pr_err("%s: Failed to set codec registers config %d\n",
__func__, rc);
return rc;
}
- config_data = taiko_get_afe_config(codec, AFE_SLIMBUS_SLAVE_CONFIG);
+ config_data = apq8084_codec_fn.get_afe_config_fn(codec,
+ AFE_SLIMBUS_SLAVE_CONFIG);
rc = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
if (rc) {
pr_err("%s: Failed to set slimbus slave config %d\n", __func__,
@@ -1569,7 +1604,7 @@ static struct notifier_block adsp_state_notifier_block = {
.priority = -INT_MAX,
};
-static int apq8084_taiko_codec_up(struct snd_soc_codec *codec)
+static int apq8084_wcd93xx_codec_up(struct snd_soc_codec *codec)
{
int err;
unsigned long timeout;
@@ -1600,12 +1635,12 @@ static int apq8084_taiko_codec_up(struct snd_soc_codec *codec)
return err;
}
-static int apq8084_taiko_event_cb(struct snd_soc_codec *codec,
+static int apq8084_codec_event_cb(struct snd_soc_codec *codec,
enum wcd9xxx_codec_event codec_event)
{
switch (codec_event) {
case WCD9XXX_CODEC_EVENT_CODEC_UP:
- return apq8084_taiko_codec_up(codec);
+ return apq8084_wcd93xx_codec_up(codec);
break;
default:
pr_err("%s: UnSupported codec event %d\n",
@@ -1622,19 +1657,22 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dapm_context *dapm = &codec->dapm;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ bool cdc_type = 0;
- /* Taiko SLIMBUS configuration
+ /* Codec SLIMBUS configuration
* RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8, RX9, RX10, RX11, RX12, RX13
* TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
* TX14, TX15, TX16
*/
- unsigned int rx_ch[TAIKO_RX_MAX] = {144, 145, 146, 147, 148, 149, 150,
+ unsigned int rx_ch[TOMTOM_RX_MAX] = {144, 145, 146, 147, 148, 149, 150,
151, 152, 153, 154, 155, 156};
- unsigned int tx_ch[TAIKO_TX_MAX] = {128, 129, 130, 131, 132, 133,
+ unsigned int tx_ch[TOMTOM_TX_MAX] = {128, 129, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139,
140, 141, 142, 143};
pr_info("%s(), dev_name%s\n", __func__, dev_name(cpu_dai->dev));
+ if (!strcmp(dev_name(codec_dai->dev), "tomtom_codec"))
+ cdc_type = 1; /* TOMTOM codec */
rtd->pmdown_time = 0;
err = snd_soc_add_codec_controls(codec, msm_snd_controls,
ARRAY_SIZE(msm_snd_controls));
@@ -1711,20 +1749,33 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dai_set_channel_map(codec_dai, ARRAY_SIZE(tx_ch),
tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
+ if (cdc_type) {
+ apq8084_codec_fn.mclk_enable_fn = tomtom_mclk_enable;
+ apq8084_codec_fn.get_afe_config_fn = tomtom_get_afe_config;
+ apq8084_codec_fn.mbhc_hs_detect = tomtom_hs_detect;
+ apq8084_codec_fn.mbhc_hs_detect_exit = tomtom_hs_detect_exit;
+ } else {
+ apq8084_codec_fn.mclk_enable_fn = taiko_mclk_enable;
+ apq8084_codec_fn.get_afe_config_fn = taiko_get_afe_config;
+ apq8084_codec_fn.mbhc_hs_detect = taiko_hs_detect;
+ apq8084_codec_fn.mbhc_hs_detect_exit = taiko_hs_detect_exit;
+ }
+
err = msm_afe_set_config(codec);
if (err) {
pr_err("%s: Failed to set AFE config %d\n", __func__, err);
goto out;
}
- config_data = taiko_get_afe_config(codec, AFE_AANC_VERSION);
+ config_data = apq8084_codec_fn.get_afe_config_fn(codec,
+ AFE_AANC_VERSION);
err = afe_set_config(AFE_AANC_VERSION, config_data, 0);
if (err) {
pr_err("%s: Failed to set aanc version %d\n",
__func__, err);
goto out;
}
- config_data = taiko_get_afe_config(codec,
+ config_data = apq8084_codec_fn.get_afe_config_fn(codec,
AFE_CDC_CLIP_REGISTERS_CONFIG);
if (config_data) {
err = afe_set_config(AFE_CDC_CLIP_REGISTERS_CONFIG,
@@ -1735,7 +1786,8 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
return err;
}
}
- config_data = taiko_get_afe_config(codec, AFE_CLIP_BANK_SEL);
+ config_data = apq8084_codec_fn.get_afe_config_fn(codec,
+ AFE_CLIP_BANK_SEL);
if (config_data) {
err = afe_set_config(AFE_CLIP_BANK_SEL, config_data, 0);
if (err) {
@@ -1745,9 +1797,10 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
}
}
/* start mbhc */
- mbhc_cfg.calibration = def_taiko_mbhc_cal();
+ mbhc_cfg.calibration = def_codec_mbhc_cal();
if (mbhc_cfg.calibration) {
- err = taiko_hs_detect(codec, &mbhc_cfg);
+ err = apq8084_codec_fn.mbhc_hs_detect(codec,
+ &mbhc_cfg);
if (err)
goto out;
} else {
@@ -1761,11 +1814,15 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
pr_err("%s: Failed to register adsp state notifier\n",
__func__);
err = -EFAULT;
- taiko_hs_detect_exit(codec);
+ apq8084_codec_fn.mbhc_hs_detect_exit(codec);
goto out;
}
- taiko_event_register(apq8084_taiko_event_cb, rtd->codec);
+ if (cdc_type)
+ tomtom_event_register(apq8084_codec_event_cb, rtd->codec);
+ else
+ taiko_event_register(apq8084_codec_event_cb, rtd->codec);
+ codec_reg_done = true;
return 0;
out:
if (ext_mclk_gpio < 0)
@@ -1790,40 +1847,40 @@ static int apq8084_snd_startup(struct snd_pcm_substream *substream)
return 0;
}
-void *def_taiko_mbhc_cal(void)
+void *def_codec_mbhc_cal(void)
{
- void *taiko_cal;
+ void *codec_cal;
struct wcd9xxx_mbhc_btn_detect_cfg *btn_cfg;
u16 *btn_low, *btn_high;
u8 *n_ready, *n_cic, *gain;
- taiko_cal = kzalloc(WCD9XXX_MBHC_CAL_SIZE(WCD9XXX_MBHC_DEF_BUTTONS,
+ codec_cal = kzalloc(WCD9XXX_MBHC_CAL_SIZE(WCD9XXX_MBHC_DEF_BUTTONS,
WCD9XXX_MBHC_DEF_RLOADS),
GFP_KERNEL);
- if (!taiko_cal) {
+ if (!codec_cal) {
pr_err("%s: out of memory\n", __func__);
return NULL;
}
-#define S(X, Y) ((WCD9XXX_MBHC_CAL_GENERAL_PTR(taiko_cal)->X) = (Y))
+#define S(X, Y) ((WCD9XXX_MBHC_CAL_GENERAL_PTR(codec_cal)->X) = (Y))
S(t_ldoh, 100);
S(t_bg_fast_settle, 100);
S(t_shutdown_plug_rem, 255);
S(mbhc_nsa, 4);
S(mbhc_navg, 4);
#undef S
-#define S(X, Y) ((WCD9XXX_MBHC_CAL_PLUG_DET_PTR(taiko_cal)->X) = (Y))
- S(mic_current, TAIKO_PID_MIC_5_UA);
- S(hph_current, TAIKO_PID_MIC_5_UA);
+#define S(X, Y) ((WCD9XXX_MBHC_CAL_PLUG_DET_PTR(codec_cal)->X) = (Y))
+ S(mic_current, TOMTOM_PID_MIC_5_UA);
+ S(hph_current, TOMTOM_PID_MIC_5_UA);
S(t_mic_pid, 100);
S(t_ins_complete, 250);
S(t_ins_retry, 200);
#undef S
-#define S(X, Y) ((WCD9XXX_MBHC_CAL_PLUG_TYPE_PTR(taiko_cal)->X) = (Y))
+#define S(X, Y) ((WCD9XXX_MBHC_CAL_PLUG_TYPE_PTR(codec_cal)->X) = (Y))
S(v_no_mic, 30);
S(v_hs_max, 2400);
#undef S
-#define S(X, Y) ((WCD9XXX_MBHC_CAL_BTN_DET_PTR(taiko_cal)->X) = (Y))
+#define S(X, Y) ((WCD9XXX_MBHC_CAL_BTN_DET_PTR(codec_cal)->X) = (Y))
S(c[0], 62);
S(c[1], 124);
S(nc, 1);
@@ -1835,7 +1892,7 @@ void *def_taiko_mbhc_cal(void)
S(v_btn_press_delta_sta, 100);
S(v_btn_press_delta_cic, 50);
#undef S
- btn_cfg = WCD9XXX_MBHC_CAL_BTN_DET_PTR(taiko_cal);
+ btn_cfg = WCD9XXX_MBHC_CAL_BTN_DET_PTR(codec_cal);
btn_low = wcd9xxx_mbhc_cal_btn_det_mp(btn_cfg, MBHC_BTN_DET_V_BTN_LOW);
btn_high = wcd9xxx_mbhc_cal_btn_det_mp(btn_cfg,
MBHC_BTN_DET_V_BTN_HIGH);
@@ -1865,7 +1922,7 @@ void *def_taiko_mbhc_cal(void)
gain[0] = 11;
gain[1] = 9;
- return taiko_cal;
+ return codec_cal;
}
static int msm_snd_hw_params(struct snd_pcm_substream *substream,
@@ -1903,10 +1960,10 @@ static int msm_snd_hw_params(struct snd_pcm_substream *substream,
pr_err("%s: failed to get codec chan map\n", __func__);
goto end;
}
- /* For taiko_tx1 case */
+ /* For <codec>_tx1 case */
if (codec_dai->id == 1)
user_set_tx_ch = msm_slim_0_tx_ch;
- /* For taiko_tx2 case */
+ /* For <codec>_tx2 case */
else if (codec_dai->id == 3)
user_set_tx_ch = params_channels(params);
else if (codec_dai->id == 5)
@@ -2538,43 +2595,6 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.be_id = MSM_FRONTEND_DAI_MULTIMEDIA6,
},
{
- .name = LPASS_BE_SLIMBUS_4_TX,
- .stream_name = "Slimbus4 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16393",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_vifeedback",
- .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
- .be_hw_params_fixup = msm_slim_4_tx_be_hw_params_fixup,
- .ops = &apq8084_be_ops,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ignore_suspend = 1,
- },
- /* Ultrasound RX Back End DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Playback",
- .stream_name = "SLIMBUS_2 Hostless Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16388",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_rx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &apq8084_slimbus_2_be_ops,
- },
- /* Ultrasound TX Back End DAI Link */
- {
- .name = "SLIMBUS_2 Hostless Capture",
- .stream_name = "SLIMBUS_2 Hostless Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16389",
- .platform_name = "msm-pcm-hostless",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_tx2",
- .ignore_suspend = 1,
- .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
- .ops = &apq8084_slimbus_2_be_ops,
- },
- {
.name = "Voice2 Stub",
.stream_name = "Voice2 Stub",
.cpu_dai_name = "VOICE2_STUB",
@@ -2694,6 +2714,89 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.codec_name = "snd-soc-dummy",
.be_id = MSM_FRONTEND_DAI_LSM8,
},
+};
+
+static struct snd_soc_dai_link apq8084_tomtom_fe_dai_links[] = {
+ {
+ .name = LPASS_BE_SLIMBUS_4_TX,
+ .stream_name = "Slimbus4 Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16393",
+ .platform_name = "msm-pcm-hostless",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_vifeedback",
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
+ .be_hw_params_fixup = msm_slim_4_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+ .ignore_suspend = 1,
+ },
+ /* Ultrasound RX Back End DAI Link */
+ {
+ .name = "SLIMBUS_2 Hostless Playback",
+ .stream_name = "SLIMBUS_2 Hostless Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16388",
+ .platform_name = "msm-pcm-hostless",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_rx2",
+ .ignore_suspend = 1,
+ .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+ .ops = &apq8084_slimbus_2_be_ops,
+ },
+ /* Ultrasound TX Back End DAI Link */
+ {
+ .name = "SLIMBUS_2 Hostless Capture",
+ .stream_name = "SLIMBUS_2 Hostless Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16389",
+ .platform_name = "msm-pcm-hostless",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_tx2",
+ .ignore_suspend = 1,
+ .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+ .ops = &apq8084_slimbus_2_be_ops,
+ },
+};
+
+static struct snd_soc_dai_link apq8084_taiko_fe_dai_links[] = {
+ {
+ .name = LPASS_BE_SLIMBUS_4_TX,
+ .stream_name = "Slimbus4 Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16393",
+ .platform_name = "msm-pcm-hostless",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_vifeedback",
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
+ .be_hw_params_fixup = msm_slim_4_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+ .ignore_suspend = 1,
+ },
+ /* Ultrasound RX Back End DAI Link */
+ {
+ .name = "SLIMBUS_2 Hostless Playback",
+ .stream_name = "SLIMBUS_2 Hostless Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16388",
+ .platform_name = "msm-pcm-hostless",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_rx2",
+ .ignore_suspend = 1,
+ .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+ .ops = &apq8084_slimbus_2_be_ops,
+ },
+ /* Ultrasound TX Back End DAI Link */
+ {
+ .name = "SLIMBUS_2 Hostless Capture",
+ .stream_name = "SLIMBUS_2 Hostless Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16389",
+ .platform_name = "msm-pcm-hostless",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_tx2",
+ .ignore_suspend = 1,
+ .no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+ .ops = &apq8084_slimbus_2_be_ops,
+ },
+};
+
+static struct snd_soc_dai_link apq8084_common_be_dai_links[] = {
/* Backend AFE DAI Links */
{
.name = LPASS_BE_AFE_PCM_RX,
@@ -2779,36 +2882,6 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.ops = &msm_sec_auxpcm_be_ops,
.ignore_suspend = 1,
},
- /* Slimbus Backend DAI Links */
- {
- .name = LPASS_BE_SLIMBUS_0_RX,
- .stream_name = "Slimbus Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16384",
- .platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_rx1",
- .no_pcm = 1,
- .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
- .init = &msm_audrx_init,
- .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
- .ops = &apq8084_be_ops,
- .ignore_pmdown_time = 1,
- /* this dai link has playback support */
- .ignore_suspend = 1,
- },
- {
- .name = LPASS_BE_SLIMBUS_0_TX,
- .stream_name = "Slimbus Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16385",
- .platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_tx1",
- .no_pcm = 1,
- .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
- .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
- .ops = &apq8084_be_ops,
- .ignore_suspend = 1,
- },
{
.name = LPASS_BE_SLIMBUS_1_RX,
.stream_name = "Slimbus1 Playback",
@@ -2865,21 +2938,6 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.ops = &apq8084_slimbus_3_be_ops,
.ignore_suspend = 1,
},
- {
- .name = LPASS_BE_SLIMBUS_4_RX,
- .stream_name = "Slimbus4 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16392",
- .platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_rx1",
- .no_pcm = 1,
- .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
- .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
- .ops = &apq8084_be_ops,
- /* this dai link has playback support */
- .ignore_pmdown_time = 1,
- .ignore_suspend = 1,
- },
/* Incall Record Uplink BACK END DAI Link */
{
.name = LPASS_BE_INCALL_RECORD_TX,
@@ -2906,19 +2964,6 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.be_hw_params_fixup = msm_be_hw_params_fixup,
.ignore_suspend = 1,
},
- /* MAD BE */
- {
- .name = LPASS_BE_SLIMBUS_5_TX,
- .stream_name = "Slimbus5 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16395",
- .platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_mad1",
- .no_pcm = 1,
- .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
- .be_hw_params_fixup = msm_slim_5_tx_be_hw_params_fixup,
- .ops = &apq8084_be_ops,
- },
/* Incall Music BACK END DAI Link */
{
.name = LPASS_BE_VOICE_PLAYBACK_TX,
@@ -2933,12 +2978,100 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.ignore_suspend = 1,
},
{
+ .name = LPASS_BE_SLIMBUS_6_RX,
+ .stream_name = "Slimbus6 Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16396",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "msm-stub-codec.1",
+ .codec_dai_name = "msm-stub-rx",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
+ .be_hw_params_fixup = msm_slim_6_rx_be_hw_params_fixup,
+ .ops = &apq8084_slimbus_6_be_ops,
+ .ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
+ },
+ {
+ .name = LPASS_BE_SLIMBUS_6_TX,
+ .stream_name = "Slimbus6 Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16397",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "msm-stub-codec.1",
+ .codec_dai_name = "msm-stub-tx",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_6_TX,
+ .be_hw_params_fixup = msm_slim_6_tx_be_hw_params_fixup,
+ .ops = &apq8084_slimbus_6_be_ops,
+ .ignore_suspend = 1,
+ },
+};
+
+static struct snd_soc_dai_link apq8084_tomtom_be_dai_links[] = {
+ /* Slimbus Backend DAI Links */
+ {
+ .name = LPASS_BE_SLIMBUS_0_RX,
+ .stream_name = "Slimbus Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16384",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_rx1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+ .init = &msm_audrx_init,
+ .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ .ignore_pmdown_time = 1,
+ /* this dai link has playback support */
+ .ignore_suspend = 1,
+ },
+ {
+ .name = LPASS_BE_SLIMBUS_0_TX,
+ .stream_name = "Slimbus Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16385",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_tx1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+ .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ .ignore_suspend = 1,
+ },
+ {
+ .name = LPASS_BE_SLIMBUS_4_RX,
+ .stream_name = "Slimbus4 Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16392",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_rx1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
+ .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ /* this dai link has playback support */
+ .ignore_pmdown_time = 1,
+ .ignore_suspend = 1,
+ },
+ /* MAD BE */
+ {
+ .name = LPASS_BE_SLIMBUS_5_TX,
+ .stream_name = "Slimbus5 Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16395",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_mad1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
+ .be_hw_params_fixup = msm_slim_5_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ },
+ {
.name = LPASS_BE_STUB_RX,
.stream_name = "Stub Playback",
.cpu_dai_name = "msm-dai-stub-dev.0",
.platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_rx2",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_rx2",
.no_pcm = 1,
.be_id = MSM_BACKEND_DAI_EXTPROC_RX,
.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
@@ -2953,8 +3086,8 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.stream_name = "Stub Capture",
.cpu_dai_name = "msm-dai-stub-dev.1",
.platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_tx1",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_tx1",
.no_pcm = 1,
.be_id = MSM_BACKEND_DAI_EXTPROC_TX,
.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
@@ -2966,8 +3099,8 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.stream_name = "Stub1 Capture",
.cpu_dai_name = "msm-dai-stub-dev.3",
.platform_name = "msm-pcm-routing",
- .codec_name = "taiko_codec",
- .codec_dai_name = "taiko_tx3",
+ .codec_name = "tomtom_codec",
+ .codec_dai_name = "tomtom_tx3",
.no_pcm = 1,
.be_id = MSM_BACKEND_DAI_EXTPROC_EC_TX,
/* This BE is used for external EC reference from codec. Since
@@ -2978,31 +3111,111 @@ static struct snd_soc_dai_link apq8084_common_dai_links[] = {
.ops = &apq8084_be_ops,
.ignore_suspend = 1,
},
+};
+
+static struct snd_soc_dai_link apq8084_taiko_be_dai_links[] = {
+ /* Slimbus Backend DAI Links */
{
- .name = LPASS_BE_SLIMBUS_6_RX,
- .stream_name = "Slimbus6 Playback",
- .cpu_dai_name = "msm-dai-q6-dev.16396",
+ .name = LPASS_BE_SLIMBUS_0_RX,
+ .stream_name = "Slimbus Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16384",
.platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_rx1",
.no_pcm = 1,
- .be_id = MSM_BACKEND_DAI_SLIMBUS_6_RX,
- .be_hw_params_fixup = msm_slim_6_rx_be_hw_params_fixup,
- .ops = &apq8084_slimbus_6_be_ops,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+ .init = &msm_audrx_init,
+ .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ .ignore_pmdown_time = 1,
+ /* this dai link has playback support */
+ .ignore_suspend = 1,
+ },
+ {
+ .name = LPASS_BE_SLIMBUS_0_TX,
+ .stream_name = "Slimbus Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16385",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_tx1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+ .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
.ignore_suspend = 1,
+ },
+ {
+ .name = LPASS_BE_SLIMBUS_4_RX,
+ .stream_name = "Slimbus4 Playback",
+ .cpu_dai_name = "msm-dai-q6-dev.16392",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_rx1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX,
+ .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ /* this dai link has playback support */
.ignore_pmdown_time = 1,
+ .ignore_suspend = 1,
},
+ /* MAD BE */
{
- .name = LPASS_BE_SLIMBUS_6_TX,
- .stream_name = "Slimbus6 Capture",
- .cpu_dai_name = "msm-dai-q6-dev.16397",
+ .name = LPASS_BE_SLIMBUS_5_TX,
+ .stream_name = "Slimbus5 Capture",
+ .cpu_dai_name = "msm-dai-q6-dev.16395",
.platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_mad1",
.no_pcm = 1,
- .be_id = MSM_BACKEND_DAI_SLIMBUS_6_TX,
- .be_hw_params_fixup = msm_slim_6_tx_be_hw_params_fixup,
- .ops = &apq8084_slimbus_6_be_ops,
+ .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX,
+ .be_hw_params_fixup = msm_slim_5_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ },
+ {
+ .name = LPASS_BE_STUB_RX,
+ .stream_name = "Stub Playback",
+ .cpu_dai_name = "msm-dai-stub-dev.0",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_rx2",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_EXTPROC_RX,
+ .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+ .init = &msm_stubrx_init,
+ .ops = &apq8084_be_ops,
+ .ignore_suspend = 1,
+ /* this dainlink has playback support */
+ .ignore_pmdown_time = 1,
+ },
+ {
+ .name = LPASS_BE_STUB_TX,
+ .stream_name = "Stub Capture",
+ .cpu_dai_name = "msm-dai-stub-dev.1",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_tx1",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_EXTPROC_TX,
+ .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
+ .ignore_suspend = 1,
+ },
+ {
+ .name = LPASS_BE_STUB_1_TX,
+ .stream_name = "Stub1 Capture",
+ .cpu_dai_name = "msm-dai-stub-dev.3",
+ .platform_name = "msm-pcm-routing",
+ .codec_name = "taiko_codec",
+ .codec_dai_name = "taiko_tx3",
+ .no_pcm = 1,
+ .be_id = MSM_BACKEND_DAI_EXTPROC_EC_TX,
+ /* This BE is used for external EC reference from codec. Since
+ * Rx is fed as reference for EC, the config of this DAI is
+ * based on that of the Rx path.
+ */
+ .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+ .ops = &apq8084_be_ops,
.ignore_suspend = 1,
},
};
@@ -3024,11 +3237,25 @@ static struct snd_soc_dai_link apq8084_hdmi_dai_link[] = {
},
};
-static struct snd_soc_dai_link apq8084_dai_links[
+static struct snd_soc_dai_link apq8084_taiko_dai_links[
+ ARRAY_SIZE(apq8084_common_dai_links) +
+ ARRAY_SIZE(apq8084_taiko_fe_dai_links) +
+ ARRAY_SIZE(apq8084_common_be_dai_links) +
+ ARRAY_SIZE(apq8084_taiko_be_dai_links) +
+ ARRAY_SIZE(apq8084_hdmi_dai_link)];
+
+static struct snd_soc_dai_link apq8084_tomtom_dai_links[
ARRAY_SIZE(apq8084_common_dai_links) +
+ ARRAY_SIZE(apq8084_tomtom_fe_dai_links) +
+ ARRAY_SIZE(apq8084_common_be_dai_links) +
+ ARRAY_SIZE(apq8084_tomtom_be_dai_links) +
ARRAY_SIZE(apq8084_hdmi_dai_link)];
-struct snd_soc_card snd_soc_card_apq8084 = {
+struct snd_soc_card snd_soc_card_tomtom_apq8084 = {
+ .name = "apq8084-tomtom-snd-card",
+};
+
+struct snd_soc_card snd_soc_card_taiko_apq8084 = {
.name = "apq8084-taiko-snd-card",
};
@@ -3103,10 +3330,11 @@ static int apq8084_prepare_us_euro(struct snd_soc_card *card)
if (pdata->us_euro_gpio >= 0) {
dev_dbg(card->dev, "%s : us_euro gpio request %d", __func__,
pdata->us_euro_gpio);
- ret = gpio_request(pdata->us_euro_gpio, "TAIKO_CODEC_US_EURO");
+ ret = gpio_request(pdata->us_euro_gpio,
+ "WCD93XX_CODEC_US_EURO");
if (ret) {
dev_err(card->dev,
- "%s: Failed to request taiko US/EURO gpio %d error %d\n",
+ "%s: Failed to request Codec US/EURO gpio %d error %d\n",
__func__, pdata->us_euro_gpio, ret);
return ret;
}
@@ -3114,12 +3342,90 @@ static int apq8084_prepare_us_euro(struct snd_soc_card *card)
return 0;
}
+static const struct of_device_id apq8084_asoc_machine_of_match[] = {
+ { .compatible = "qcom,apq8084-audio-taiko", .data = "taiko_codec"},
+ { .compatible = "qcom,apq8084-audio-tomtom", .data = "tomtom_codec"},
+ {},
+};
+
+static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
+{
+ struct snd_soc_card *card = NULL;
+ struct snd_soc_dai_link *dailink;
+ int len_1, len_2, len_3, len_4;
+ const struct of_device_id *match;
+
+ match = of_match_node(apq8084_asoc_machine_of_match, dev->of_node);
+
+ if (!strcmp(match->data, "tomtom_codec")) {
+ card = &snd_soc_card_tomtom_apq8084;
+ len_1 = ARRAY_SIZE(apq8084_common_dai_links);
+ len_2 = len_1 + ARRAY_SIZE(apq8084_tomtom_fe_dai_links);
+ len_3 = len_2 + ARRAY_SIZE(apq8084_common_be_dai_links);
+
+ memcpy(apq8084_tomtom_dai_links,
+ apq8084_common_dai_links,
+ sizeof(apq8084_common_dai_links));
+ memcpy(apq8084_tomtom_dai_links + len_1,
+ apq8084_tomtom_fe_dai_links,
+ sizeof(apq8084_tomtom_fe_dai_links));
+ memcpy(apq8084_tomtom_dai_links + len_2,
+ apq8084_common_be_dai_links,
+ sizeof(apq8084_common_be_dai_links));
+ memcpy(apq8084_tomtom_dai_links + len_3,
+ apq8084_tomtom_be_dai_links,
+ sizeof(apq8084_tomtom_be_dai_links));
+
+ dailink = apq8084_tomtom_dai_links;
+ len_4 = len_3 + ARRAY_SIZE(apq8084_tomtom_be_dai_links);
+
+ } else {
+ card = &snd_soc_card_taiko_apq8084;
+ len_1 = ARRAY_SIZE(apq8084_common_dai_links);
+ len_2 = len_1 + ARRAY_SIZE(apq8084_taiko_fe_dai_links);
+ len_3 = len_2 + ARRAY_SIZE(apq8084_common_be_dai_links);
+
+ memcpy(apq8084_taiko_dai_links,
+ apq8084_common_dai_links,
+ sizeof(apq8084_common_dai_links));
+ memcpy(apq8084_taiko_dai_links + len_1,
+ apq8084_taiko_fe_dai_links,
+ sizeof(apq8084_taiko_fe_dai_links));
+ memcpy(apq8084_taiko_dai_links + len_2,
+ apq8084_common_be_dai_links,
+ sizeof(apq8084_common_be_dai_links));
+ memcpy(apq8084_taiko_dai_links + len_3,
+ apq8084_taiko_be_dai_links,
+ sizeof(apq8084_taiko_be_dai_links));
+
+ dailink = apq8084_taiko_dai_links;
+ len_4 = len_3 + ARRAY_SIZE(apq8084_taiko_be_dai_links);
+ }
+
+ if (of_property_read_bool(dev->of_node, "qcom,hdmi-audio-rx")) {
+ dev_dbg(dev, "%s(): hdmi audio support present\n",
+ __func__);
+ memcpy(dailink + len_4, apq8084_hdmi_dai_link,
+ sizeof(apq8084_hdmi_dai_link));
+ len_4 += ARRAY_SIZE(apq8084_hdmi_dai_link);
+ } else {
+ dev_dbg(dev, "%s(): No hdmi audio support\n", __func__);
+ }
+
+ card->dai_link = dailink;
+ card->num_links = len_4;
+
+ return card;
+}
+
static int apq8084_asoc_machine_probe(struct platform_device *pdev)
{
- struct snd_soc_card *card = &snd_soc_card_apq8084;
+ struct snd_soc_card *card;
struct apq8084_asoc_mach_data *pdata;
int ret;
const char *auxpcm_pri_gpio_set = NULL;
+ const struct of_device_id *match;
+ char *mclk_freq_prop_name;
if (!pdev->dev.of_node) {
dev_err(&pdev->dev, "No platform supplied from device tree\n");
@@ -3132,6 +3438,13 @@ static int apq8084_asoc_machine_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ card = populate_snd_card_dailinks(&pdev->dev);
+ if (!card) {
+ dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
+ ret = -EINVAL;
+ goto err;
+ }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, pdata);
@@ -3144,52 +3457,40 @@ static int apq8084_asoc_machine_probe(struct platform_device *pdev)
if (ret)
goto err;
+ match = of_match_node(apq8084_asoc_machine_of_match,
+ pdev->dev.of_node);
+ if (!strcmp(match->data, "tomtom_codec"))
+ mclk_freq_prop_name = "qcom,tomtom-mclk-clk-freq";
+ else
+ mclk_freq_prop_name = "qcom,taiko-mclk-clk-freq";
+
ret = of_property_read_u32(pdev->dev.of_node,
- "qcom,taiko-mclk-clk-freq", &pdata->mclk_freq);
+ mclk_freq_prop_name, &pdata->mclk_freq);
if (ret) {
dev_err(&pdev->dev, "Looking up %s property in node %s failed",
- "qcom,taiko-mclk-clk-freq",
+ mclk_freq_prop_name,
pdev->dev.of_node->full_name);
goto err;
}
if (pdata->mclk_freq != 9600000) {
- dev_err(&pdev->dev, "unsupported taiko mclk freq %u\n",
+ dev_err(&pdev->dev, "unsupported codec mclk freq %u\n",
pdata->mclk_freq);
ret = -EINVAL;
goto err;
}
- if (of_property_read_bool(pdev->dev.of_node, "qcom,hdmi-audio-rx")) {
- dev_info(&pdev->dev, "%s(): hdmi audio support present\n",
- __func__);
-
- memcpy(apq8084_dai_links, apq8084_common_dai_links,
- sizeof(apq8084_common_dai_links));
-
- memcpy(apq8084_dai_links + ARRAY_SIZE(apq8084_common_dai_links),
- apq8084_hdmi_dai_link, sizeof(apq8084_hdmi_dai_link));
-
- card->dai_link = apq8084_dai_links;
- card->num_links = ARRAY_SIZE(apq8084_dai_links);
- } else {
- dev_info(&pdev->dev, "%s(): No hdmi audio support\n", __func__);
-
- card->dai_link = apq8084_common_dai_links;
- card->num_links = ARRAY_SIZE(apq8084_common_dai_links);
- }
-
mutex_init(&cdc_mclk_mutex);
atomic_set(&prim_auxpcm_rsc_ref, 0);
atomic_set(&sec_auxpcm_rsc_ref, 0);
spdev = pdev;
- ext_spk_amp_regulator = NULL;
- apq8084_liquid_dock_dev = NULL;
ret = snd_soc_register_card(card);
- if (ret == -EPROBE_DEFER)
+ if (ret == -EPROBE_DEFER) {
+ if (codec_reg_done)
+ ret = -EINVAL;
goto err;
- else if (ret) {
+ } else if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
goto err;
@@ -3268,7 +3569,6 @@ err:
gpio_free(pdata->us_euro_gpio);
pdata->us_euro_gpio = 0;
}
- mutex_destroy(&cdc_mclk_mutex);
devm_kfree(&pdev->dev, pdata);
return ret;
}
@@ -3309,11 +3609,6 @@ static int apq8084_asoc_machine_remove(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id apq8084_asoc_machine_of_match[] = {
- { .compatible = "qcom,apq8084-audio-taiko", },
- {},
-};
-
static struct platform_driver apq8084_asoc_machine_driver = {
.driver = {
.name = DRV_NAME,