Here is a patch i used to get it working with all codecs removed [requires unselecting / selecting options in .config
Please note the documentation is misleading the MCLK is not the 19.2 Oscilator its a clock for running the DAC’s/ADC on the codec 12.288Mhz
Audio is I2S Master [codec slave] 48000 ignore the 1.5Mhz reference in datasheet …
The patch bellow also includes the spisvc driver that can be built at the same time.
diff --git a/arch/arm/mach-msm/board-9615-gpiomux.c b/arch/arm/mach-msm/board-9615-gpiomux.c
index bcb5288..0928bf2 100755
--- a/arch/arm/mach-msm/board-9615-gpiomux.c
+++ b/arch/arm/mach-msm/board-9615-gpiomux.c
@@ -16,9 +16,7 @@
#include
#include
#include "board-9615.h"
-#ifdef CONFIG_MFD_WM8944
#include
-#endif
static struct gpiomux_setting ps_hold = {
.func = GPIOMUX_FUNC_1,
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index 80c4272..36f3403 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -19,10 +19,6 @@
#include
#include
#endif
-#if defined(CONFIG_SIERRA_INTERNAL_CODEC) && defined(CONFIG_WCD9304_CODEC)
-#include
-#include
-#endif
#ifdef CONFIG_MFD_WM8944
#include
#endif
@@ -1341,10 +1337,11 @@ static int __init msm9615_wl18xx_init(void)
pr_info("wl18xx board initialization done\n");
- return;
+ return 0;
fail:
pr_err("%s: wl1251 board initialisation failed\n", __func__);
+ return -1;
}
#endif
@@ -1796,7 +1793,7 @@ void gpio_cf3_low_power_reset_timer_callback(unsigned long state)
jiffies + msecs_to_jiffies(GPIO_CF3_LOW_POWER_RESET_TIMER_TOUT_MS));
if(ret) {
/* Nothing we can do about it. */
- printk(KERN_ERR "%s: LowPower_RESET pin toggle timer could not be armed, state=%d\n",
+ printk(KERN_ERR "%s: LowPower_RESET pin toggle timer could not be armed, state=%ld\n",
__func__, state);
del_timer (&gpio_cf3_low_power_reset_timer);
}
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 495b164..07cc6d1 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -572,6 +572,14 @@ config SPI_SPIDEV
Note that this application programming interface is EXPERIMENTAL
and hence SUBJECT TO CHANGE WITHOUT NOTICE while it stabilizes.
+config SPI_SPISVC
+ tristate "User mode SPI device driver support (msm)"
+ help
+ This supports user mode SPI protocol drivers.
+
+ Note that this application programming interface is EXPERIMENTAL
+ and hence SUBJECT TO CHANGE WITHOUT NOTICE while it stabilizes.
+
config SPI_TLE62X0
tristate "Infineon TLE62X0 (for power switching)"
depends on SYSFS
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 7b9875c..322e31a 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -8,6 +8,7 @@ ccflags-$(CONFIG_SPI_DEBUG) := -DDEBUG
# config declarations into driver model code
obj-$(CONFIG_SPI_MASTER) += spi.o
obj-$(CONFIG_SPI_SPIDEV) += spidev.o
+obj-$(CONFIG_SPI_SPISVC) += spisvc.o
# SPI master controller drivers (bus)
obj-$(CONFIG_SPI_ALTERA) += spi-altera.o
diff --git a/drivers/spi/spisvc.c b/drivers/spi/spisvc.c
new file mode 100644
index 0000000..021e056
--- /dev/null
+++ b/drivers/spi/spisvc.c
@@ -0,0 +1,63 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the version 2 of the GNU General Public License
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see .
+ *
+ * Copyright (C) 2016 Sierra Wireless Inc.
+ */
+
+#include
+#include
+#include
+
+#define MOD_DESC "Spidev creation module"
+
+MODULE_DESCRIPTION(MOD_DESC);
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Sierra Wireless, Inc.");
+
+static struct spi_device *spidev;
+
+static __init int spisvc_init(void)
+{
+ struct spi_master *master;
+ struct spi_board_info board = {
+ .modalias = "spidev",
+ .max_speed_hz = 15058800,
+ .mode = SPI_MODE_3,
+ .platform_data = NULL,
+ .bus_num = 0,
+ .chip_select = 0,
+ .irq = 0,
+ };
+
+ master = spi_busnum_to_master(0);
+ if (!master) {
+ pr_err("No master for SPI bus 0.\n");
+ return -ENODEV;
+ }
+
+ spidev = spi_new_device(master, &board);
+ if (!spidev) {
+ pr_err("Error creating device '%s'\n", board.modalias);
+ return -ENODEV;
+ }
+ return 0;
+}
+module_init(spisvc_init);
+
+static __exit void spisvc_exit(void)
+{
+ if (spidev)
+ spi_unregister_device(spidev);
+}
+module_exit(spisvc_exit);
+
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index da2bbcc..87b8f2f 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -385,10 +385,10 @@ config SND_SOC_UDA1380
tristate
config SND_SOC_WCD9304
- tristate
+ tristate "WCD9304"
config SND_SOC_WCD9310
- tristate
+ tristate "WCD9310"
config SND_SOC_WL1273
tristate
@@ -478,7 +478,7 @@ config SND_SOC_WM8940
tristate
config SND_SOC_WM8944
- tristate
+ tristate "Wolfson WM8944"
config SND_SOC_WM8955
tristate
@@ -566,4 +566,7 @@ config SND_SOC_TPA6130A2
tristate
config SND_SOC_MSM_STUB
- tristate
+ tristate "Stub Driver"
+
+config SND_SOC_NOCODEC_PCM
+ tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 2b43faa..2845a16 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -128,6 +128,7 @@ snd-soc-wm9712-objs := wm9712.o
snd-soc-wm9713-objs := wm9713.o
snd-soc-wm-hubs-objs := wm_hubs.o
snd-soc-msm-stub-objs := msm_stub.o
+snd-soc-nocodec-objs := nocodec.o
# Amp
snd-soc-max9877-objs := max9877.o
snd-soc-tpa6130a2-objs := tpa6130a2.o
@@ -261,6 +262,7 @@ obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o
obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
obj-$(CONFIG_SND_SOC_MSM_STUB) += snd-soc-msm-stub.o
+obj-$(CONFIG_SND_SOC_NOCODEC_PCM) += snd-soc-nocodec.o
# Amp
obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o
diff --git a/sound/soc/codecs/nocodec.c b/sound/soc/codecs/nocodec.c
new file mode 100644
index 0000000..a51be66
--- /dev/null
+++ b/sound/soc/codecs/nocodec.c
@@ -0,0 +1,190 @@
+/* Copyright (c) 2011, 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
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * No codec platform driver soundcard for MSM / MDM9615
+ * Gregory Hinton Nietsky
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+static struct platform_device *msm_nocodec_device;
+
+#define NOCODEC_RATES SNDRV_PCM_RATE_8000_48000
+
+#define NOCODEC_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
+ SNDRV_PCM_FMTBIT_S16_LE | \
+ SNDRV_PCM_FMTBIT_S20_3LE | \
+ SNDRV_PCM_FMTBIT_S24_LE | \
+ SNDRV_PCM_FMTBIT_S32_LE)
+
+
+static int nocodec_codec_probe(struct snd_soc_codec *codec) {
+ printk(KERN_INFO "NOCODEC: %s \n", __func__);
+ return 0;
+}
+
+static struct snd_soc_codec_driver soc_msm_nocodec = {
+ .probe = nocodec_codec_probe,
+/* .remove = wm8944_codec_remove,
+ .suspend = wm8944_codec_suspend,
+ .resume = wm8944_codec_resume,
+ .set_bias_level = wm8944_set_bias_level,*/
+};
+
+static int nocodec_set_dai_sysclk(struct snd_soc_dai *dai,int clk_id, unsigned int freq, int dir) {
+ printk(KERN_INFO "NOCODEC: %s clk_id=%d freq=%d dir=%d, \n", __func__, clk_id, freq, dir);
+ return 0;
+}
+
+static int nocodec_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) {
+ printk(KERN_INFO "NOCODEC: %s div_id=%d div=%d, \n", __func__, div_id, div);
+ return 0;
+}
+
+static int nocodec_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) {
+ printk(KERN_INFO "%s fmt=0x%x\n", __func__, fmt);
+
+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+ case SND_SOC_DAIFMT_CBM_CFM: // codec clk & FRM master
+ printk(KERN_INFO "%s MASTER\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_CBS_CFS: // codec clk & FRM slav
+ printk(KERN_INFO "%s SLAVE\n", __func__);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+ case SND_SOC_DAIFMT_I2S:
+ printk(KERN_INFO "%s I2S\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_LEFT_J:
+ printk(KERN_INFO "%s LEFT_J\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_RIGHT_J://not supported
+ printk(KERN_INFO "%s RIGHT_J\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_DSP_A:
+ printk(KERN_INFO "%s DSP_A\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_DSP_B:
+ printk(KERN_INFO "%s DSP_B\n", __func__);
+ break;
+ }
+
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+ case SND_SOC_DAIFMT_NB_NF:
+ printk(KERN_INFO "%s Normal BCLK/Frame\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_NB_IF:
+ printk(KERN_INFO "%s Normal BCLK/-Frame\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_IB_NF:
+ printk(KERN_INFO "%s Normal -BCLK/Frame\n", __func__);
+ break;
+ case SND_SOC_DAIFMT_IB_IF:
+ printk(KERN_INFO "%s Normal -BCLK/-Frame\n", __func__);
+ break;
+ }
+
+ return 0;
+}
+
+static int nocodec_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) {
+ printk(KERN_INFO "%s \n", __func__);
+ return 0;
+}
+
+static struct snd_soc_dai_ops nocodec_dai_ops = {
+ .set_sysclk = nocodec_set_dai_sysclk,
+ .set_clkdiv = nocodec_set_dai_clkdiv,
+ .set_fmt = nocodec_set_dai_fmt,
+ .hw_params = nocodec_i2s_hw_params,
+/*
+ .digital_mute = wm8944_mute,
+ .trigger = wm8944_trigger,*/
+};
+
+/* A dummy driver useful only to advertise hardware parameters */
+static struct snd_soc_dai_driver msm_nocodec_dais = {
+ .name = "msm-nocodec-hifi",
+ .id = 0,
+ .playback = { /* Support maximum range */
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = NOCODEC_FORMATS,
+ },
+ .capture = { /* Support maximum range */
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = NOCODEC_FORMATS,
+ },
+ .ops = &nocodec_dai_ops,
+ .symmetric_rates = 1,
+};
+
+static int nocodec_probe(struct platform_device *pdev) {
+ printk(KERN_INFO "NOCODEC: %s \n", __func__);
+
+ snd_soc_register_codec(&pdev->dev, &soc_msm_nocodec, &msm_nocodec_dais, 1);
+
+ return 0;
+}
+
+static int nocodec_remove(struct platform_device *pdev) {
+ printk(KERN_INFO "NOCODEC: %s \n", __func__);
+ return 0;
+}
+
+
+static struct platform_driver nocodec_codec_driver = {
+ .driver = {
+ .name = "msm-nocodec-codec",
+ .owner = THIS_MODULE,
+ },
+ .probe = nocodec_probe,
+ .remove = nocodec_remove,
+};
+
+static int __init msm_nocodec_init(void)
+{
+ printk(KERN_INFO "NOCODEC: %s \n", __func__);
+
+ platform_driver_register(&nocodec_codec_driver);
+
+ msm_nocodec_device = platform_device_alloc("msm-nocodec-codec", -1);
+ platform_device_add(msm_nocodec_device);
+
+ return 0;
+}
+module_init(msm_nocodec_init);
+
+static void __exit msm_nocodec_exit(void)
+{
+ platform_device_unregister(&nocodec_codec_driver);
+}
+module_exit(msm_nocodec_exit);
+
+MODULE_DESCRIPTION("Generic MSM NO CODEC driver");
+MODULE_VERSION("1.0");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/msm/Kconfig b/sound/soc/msm/Kconfig
index a25ed63..21e0328 100644
--- a/sound/soc/msm/Kconfig
+++ b/sound/soc/msm/Kconfig
@@ -185,11 +185,7 @@ config SND_SOC_MDM9615
select SND_SOC_VOICE
select SND_SOC_QDSP6
select SND_SOC_MSM_STUB
- select SND_SOC_WCD9310
-#SWISTART
- select SND_SOC_WCD9304
- select SND_SOC_WM8944
-#SWISTOP
+ select SND_SOC_NOCODEC_PCM
select SND_SOC_MSM_HOSTLESS_PCM
select SND_DYNAMIC_MINORS
help
diff --git a/sound/soc/msm/mdm9615.c b/sound/soc/msm/mdm9615.c
index 96b04a3..1bd07ca 100755
--- a/sound/soc/msm/mdm9615.c
+++ b/sound/soc/msm/mdm9615.c
@@ -17,7 +17,10 @@
#include
#include
#include
+
+#ifdef CONFIG_WCD9304_CODEC
#include
+#endif
#include
#include
#include
@@ -26,7 +29,9 @@
#include
#include
#include "msm-pcm-routing.h"
+#ifdef CONFIG_WCD9310_CODEC
#include "../codecs/wcd9310.h"
+#endif
#if defined(CONFIG_SIERRA_INTERNAL_CODEC) || defined(CONFIG_SIERRA_EXTERNAL_CODEC)
#include
#include
@@ -34,8 +39,10 @@
#ifdef CONFIG_WCD9304_CODEC
#include "../codecs/wcd9304.h"
#endif
-#ifdef CONFIG_MFD_WM8944
+#ifdef CONFIG_SND_SOC_WM8944
#include "../codecs/wm8944.h"
+#endif
+#ifdef CONFIG_MFD_WM8944
#include
#include
#endif
@@ -43,6 +50,10 @@
#include
#include
+#define SLIM_MAX_RX_PORTS 7
+#define SLIM_MAX_TX_PORTS 10
+
+
static void install_codec_i2s_gpio(void);
/* 9615 machine driver */
@@ -76,6 +87,8 @@ static void install_codec_i2s_gpio(void);
#define TABLA_EXT_CLK_RATE 12288000
#ifdef CONFIG_MFD_WM8944
#define WM8944_EXT_CLK_RATE 12288000
+#else
+#define NOCODEC_EXT_CLK_RATE 12288000
#endif
#if defined(CONFIG_SIERRA_INTERNAL_CODEC)
#ifdef CONFIG_WCD9304_CODEC
@@ -481,8 +494,10 @@ static int clk_users;
static struct msm_xo_voter *xo_handle_a1;
+#ifdef CONFIG_WCD9310_CODEC
static struct snd_soc_jack hs_jack;
static struct snd_soc_jack button_jack;
+#endif
static u32 sif_reg_value = 0x0000;
static u32 spare_reg_value = 0x0000;
@@ -497,6 +512,7 @@ MODULE_PARM_DESC(hs_detect_use_firmware, "Use firmware for headset detection");
static int mdm9615_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
bool dapm);
+#ifdef CONFIG_WCD9310_CODEC
static struct tabla_mbhc_config mbhc_cfg = {
.headset_jack = &hs_jack,
.button_jack = &button_jack,
@@ -509,6 +525,7 @@ static struct tabla_mbhc_config mbhc_cfg = {
.gpio_irq = 0,
.gpio_level_insert = 1,
};
+#endif
static void mdm9615_enable_ext_spk_amp_gpio(u32 spk_amp_gpio)
{
@@ -742,15 +759,20 @@ static int mdm9615_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
{
clk_set_rate(codec_clk, SITAR_EXT_CLK_RATE);
clk_prepare_enable(codec_clk);
+#ifdef CONFIG_WCD9310_CODEC
sitar_mclk_enable(codec, 1, dapm);
+#endif
}
#endif
-#if defined(CONFIG_MFD_WM8944)
if(bssupport(BSFEATURE_WM8944) == true)
{
if (!bssupport(BSFEATURE_CF3))
{
+#if defined(CONFIG_MFD_WM8944)
clk_set_rate(codec_clk, WM8944_EXT_CLK_RATE);
+#else
+ clk_set_rate(codec_clk, NOCODEC_EXT_CLK_RATE);
+#endif
clk_prepare_enable(codec_clk);
}
else
@@ -760,7 +782,6 @@ static int mdm9615_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
}
}
#endif
-#endif
} else {
pr_debug("%s: clk_users = %d\n", __func__, clk_users);
if (clk_users == 0)
@@ -776,7 +797,7 @@ static int mdm9615_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
#ifdef CONFIG_WCD9310_CODEC
tabla_mclk_enable(codec, 0, dapm);
-#elif defined(CONFIG_WCD9304_CODEC)
+#elif defined(CONFIG_WCD9310_CODEC)
sitar_mclk_enable(codec, 0, dapm);
#endif /* #ifdef CONFIG_WCD9310_CODEC */
}
@@ -904,8 +925,10 @@ static const struct snd_soc_dapm_widget mdm9615_dapm_widgets[] = {
static const struct snd_soc_dapm_route common_audio_map[] = {
#if !defined(CONFIG_SIERRA_INTERNAL_CODEC) && !defined(CONFIG_SIERRA_EXTERNAL_CODEC)
+#if defined(CONFIG_WCD9304_CODEC)
{"RX_BIAS", NULL, "MCLK"},
{"LDO_H", NULL, "MCLK"},
+#endif
/* Speaker path */
{"Ext Spk Pos", NULL, "LINEOUT1"},
@@ -933,7 +956,9 @@ static const struct snd_soc_dapm_route common_audio_map[] = {
{"AMIC4", NULL, "MIC BIAS1 Internal2"},
{"MIC BIAS1 Internal2", NULL, "ANCLeft Headset Mic"},
+#if defined(CONFIG_WCD9304_CODEC)
{"HEADPHONE", NULL, "LDO_H"},
+#endif
/**
* The digital Mic routes are setup considering
@@ -1035,9 +1060,9 @@ static const struct snd_soc_dapm_route common_audio_map[] = {
{"AMIC3", NULL, "MIC BIAS2 External"},
{"MIC BIAS2 External", NULL, "ANCRight Headset Mic"},
-#endif
{"HEADPHONE", NULL, "LDO_H"},
+#endif
/**
* The digital Mic routes are setup considering
@@ -1849,18 +1874,16 @@ static int msm9615_i2s_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_platform *platform = rtd->platform;
-#ifdef CONFIG_MFD_WM8944
struct snd_soc_dai *codec_dai = rtd->codec_dai;
-#endif
-#ifdef CONFIG_MFD_WM8944
if(bssupport(BSFEATURE_WM8944) == true)
{
+#ifdef CONFIG_MFD_WM8944
err = snd_soc_add_codec_controls(codec, wm8944_msm9615_i2s_controls,
ARRAY_SIZE(wm8944_msm9615_i2s_controls));
+#endif
}
else
-#endif
err = snd_soc_add_codec_controls(codec, tabla_msm9615_i2s_controls,
ARRAY_SIZE(tabla_msm9615_i2s_controls));
@@ -1878,17 +1901,19 @@ static int msm9615_i2s_audrx_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_new_controls(dapm, mdm9615_dapm_widgets,
ARRAY_SIZE(mdm9615_dapm_widgets));
-#ifdef CONFIG_MFD_WM8944
if(bssupport(BSFEATURE_WM8944) == true) {
+#ifdef CONFIG_MFD_WM8944
snd_soc_dapm_add_routes(dapm, common_audio_map_wm8944,
ARRAY_SIZE(common_audio_map_wm8944));
snd_soc_dai_set_clkdiv(codec_dai, WM8944_BCLKDIV, 0);
snd_soc_dai_set_sysclk(codec_dai, WM8944_SYSCLK_MCLK,
WM8944_EXT_CLK_RATE, 0);
+#else
+ snd_soc_dai_set_sysclk(codec_dai, 1, NOCODEC_EXT_CLK_RATE, 0);
+#endif
}
else
-#endif
snd_soc_dapm_add_routes(dapm, common_audio_map,
ARRAY_SIZE(common_audio_map));
@@ -1897,10 +1922,9 @@ static int msm9615_i2s_audrx_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_sync(dapm);
-#ifdef CONFIG_MFD_WM8944
+#ifdef CONFIG_WCD9310_CODEC
if(bssupport(BSFEATURE_WM8944) == false)
{
-#endif
err = snd_soc_jack_new(codec, "Headset Jack",
(SND_JACK_HEADSET | SND_JACK_OC_HPHL|
@@ -1915,13 +1939,12 @@ static int msm9615_i2s_audrx_init(struct snd_soc_pcm_runtime *rtd)
pr_err("failed to create new jack\n");
return err;
}
-#ifdef CONFIG_MFD_WM8944
}
+#endif
if (bssupport(BSFEATURE_CF3))
{
xo_handle_a1 = msm_xo_get( MSM_XO_TCXO_A1, "cf3_mclk");
}
-#endif
codec_clk = clk_get(cpu_dai->dev, "osr_clk");
#if defined(CONFIG_SND_SOC_WCD9310) || defined(CONFIG_SND_SOC_WCD9304)
@@ -2385,7 +2408,6 @@ static int msm9615_i2s_startup(struct snd_pcm_substream *substream)
msm9615_config_i2s_spare_mux(
pintf->mux_ctl[MSM_DIR_BOTH].spareconfig,
i2s_intf);
-#ifdef CONFIG_MFD_WM8944
if(bssupport(BSFEATURE_WM8944) == true)
{
ret = snd_soc_dai_set_fmt(cpu_dai,
@@ -2399,7 +2421,6 @@ static int msm9615_i2s_startup(struct snd_pcm_substream *substream)
| SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF);
} else
-#endif
{
ret = snd_soc_dai_set_fmt(cpu_dai,
SND_SOC_DAIFMT_CBM_CFM);
@@ -2429,7 +2450,6 @@ static int msm9615_i2s_startup(struct snd_pcm_substream *substream)
msm9615_config_i2s_spare_mux(
pintf->mux_ctl[MSM_DIR_TX].spareconfig,
i2s_intf);
-#ifdef CONFIG_MFD_WM8944
if(bssupport(BSFEATURE_WM8944) == true)
{
ret = snd_soc_dai_set_fmt(cpu_dai,
@@ -2443,7 +2463,6 @@ static int msm9615_i2s_startup(struct snd_pcm_substream *substream)
| SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF);
} else
-#endif
{
ret = snd_soc_dai_set_fmt(cpu_dai,
SND_SOC_DAIFMT_CBS_CFS);
@@ -2476,7 +2495,6 @@ static int msm9615_i2s_startup(struct snd_pcm_substream *substream)
msm9615_config_i2s_spare_mux(
pintf->mux_ctl[MSM_DIR_RX].spareconfig,
i2s_intf);
-#ifdef CONFIG_MFD_WM8944
if(bssupport(BSFEATURE_WM8944) == true)
{
ret = snd_soc_dai_set_fmt(cpu_dai,
@@ -2490,7 +2508,6 @@ static int msm9615_i2s_startup(struct snd_pcm_substream *substream)
| SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF);
} else
-#endif
{
ret = snd_soc_dai_set_fmt(cpu_dai,
SND_SOC_DAIFMT_CBS_CFS);
@@ -2586,28 +2603,14 @@ static int msm9615_i2s_prepare(struct snd_pcm_substream *substream)
{
u8 ret = 0;
-#ifdef CONFIG_MFD_WM8944
+#ifdef CONFIG_WCD9304_CODEC
if ((bssupport(BSFEATURE_WM8944) == false) &&
(wcd9xxx_get_intf_type() < 0))
-#else
- if (wcd9xxx_get_intf_type() < 0)
-#endif /* #ifdef CONFIG_MFD_WM8944 */
{
ret = -ENODEV;
}
-#if !defined(CONFIG_SIERRA_INTERNAL_CODEC) && !defined(CONFIG_SIERRA_EXTERNAL_CODEC)
-
-#ifdef CONFIG_MFD_WM8944
- else if ((bssupport(BSFEATURE_WM8944) == true) ||
- (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C))
-#else
- else if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C)
-#endif /* #ifdef CONFIG_MFD_WM8944 */
-
-#endif /* #if !defined(CONFIG_SIERRA_INTERNAL_CODEC) && !defined(CONFIG_SIERRA_EXTERNAL_CODEC) */
- {
- mdm9615_install_codec_i2s_gpio(substream);
- }
+#endif
+ mdm9615_install_codec_i2s_gpio(substream);
return ret;
}
@@ -2673,6 +2676,7 @@ static int mdm9615_audrx_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_sync(dapm);
+#ifdef CONFIG_WCD9310_CODEC
err = snd_soc_jack_new(codec, "Headset Jack",
(SND_JACK_HEADSET | SND_JACK_OC_HPHL |
SND_JACK_OC_HPHR),
@@ -2688,6 +2692,8 @@ static int mdm9615_audrx_init(struct snd_soc_pcm_runtime *rtd)
pr_err("failed to create new jack\n");
return err;
}
+#endif
+
codec_clk = clk_get(cpu_dai->dev, "osr_clk");
#if !defined(CONFIG_SIERRA_INTERNAL_CODEC) && !defined(CONFIG_SIERRA_EXTERNAL_CODEC)
if (hs_detect_use_gpio) {
@@ -3195,6 +3201,7 @@ static struct snd_soc_ops mdm9615_sec_auxpcm_be_ops = {
.shutdown = mdm9615_sec_auxpcm_shutdown,
};
+#ifdef CONFIG_WCD9304_CODEC
/* Digital audio interface glue - connects codec <---> CPU */
static struct snd_soc_dai_link mdm9615_dai_common[] = {
/* FrontEnd DAI Links */
@@ -3651,6 +3658,7 @@ static struct snd_soc_dai_link mdm9615_dai_slimbus_tabla[] = {
.ops = &mdm9615_be_ops,
},
};
+#endif
#if defined(CONFIG_SIERRA_INTERNAL_CODEC) || defined(CONFIG_SIERRA_EXTERNAL_CODEC)
/* Digital audio interface glue - connects codec <---> CPU */
@@ -4416,7 +4424,6 @@ static struct snd_soc_dai_link mdm9615_dai_ar7[] = {
#endif
};
-#ifdef CONFIG_MFD_WM8944
/* Applies to the class of devices that have (or may have) a I2C/I2S connection
* to a WM8944: AR8652, AR7554RD, AR7552RD, and CF3 */
static struct snd_soc_dai_link mdm9615_dai_ar8_common[] = {
@@ -4748,6 +4755,8 @@ static struct snd_soc_dai_link mdm9615_dai_ar8_sec_pcm[] = {
.ops = &msm9615_i2s_be_ops,
},
};
+
+#ifdef CONFIG_MFD_WM8944
static struct snd_soc_dai_link mdm9615_dai_ar8_wm8944[] = {
/* AUX PCM Backend DAI Links */
{
@@ -4808,6 +4817,7 @@ static struct snd_soc_dai_link mdm9615_dai_ar8_wm8944[] = {
.ops = &msm9615_i2s_be_ops,
},
};
+#endif
/* AR8/CF3 if no codec detected, primary PCM bus available.
Must be same or less dai links than mdm9615_dai_ar8_wm8944 */
@@ -4820,27 +4830,27 @@ static struct snd_soc_dai_link mdm9615_dai_ar8_pri_pcm[] = {
.platform_name = "msm-pcm-routing",
.dpcm_capture = 1,
.dpcm_playback = 1,
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-rx",
- .init = &mdm9615_mc7_auxpcm_init,
+ .codec_name = "msm-nocodec-codec",
+ .codec_dai_name = "msm-nocodec-hifi",
+ .init = &mdm9615_auxpcm_init,
.no_pcm = 1,
.be_id = MSM_BACKEND_DAI_AUXPCM_RX,
- .be_hw_params_fixup = mdm9615_ext_auxpcm_be_params_fixup,
- .ops = &mdm9615_mc7_auxpcm_be_ops,
+ .be_hw_params_fixup = mdm9615_auxpcm_be_params_fixup,
+ .ops = &mdm9615_auxpcm_be_ops,
},
{
.name = LPASS_BE_AUXPCM_TX,
.stream_name = "AUX PCM Capture",
.cpu_dai_name = "msm-dai-q6.3",
.platform_name = "msm-pcm-routing",
- .codec_name = "msm-stub-codec.1",
- .codec_dai_name = "msm-stub-tx",
+ .codec_name = "msm-nocodec-codec",
+ .codec_dai_name = "msm-nocodec-hifi",
.dpcm_capture = 1,
.dpcm_playback = 1,
.no_pcm = 1,
.be_id = MSM_BACKEND_DAI_AUXPCM_TX,
- .be_hw_params_fixup = mdm9615_ext_auxpcm_be_params_fixup,
- .ops = &mdm9615_mc7_auxpcm_be_ops,
+ .be_hw_params_fixup = &mdm9615_auxpcm_be_params_fixup,
+ .ops = &mdm9615_auxpcm_be_ops,
},
{
.name = LPASS_BE_PRI_I2S_RX,
@@ -4876,7 +4886,10 @@ static struct snd_soc_dai_link mdm9615_dai_ar8_pri_pcm[] = {
static struct snd_soc_dai_link mdm9615_dai_ar8[
ARRAY_SIZE(mdm9615_dai_ar8_common) +
ARRAY_SIZE(mdm9615_dai_ar8_sec_pcm) +
+#ifdef CONFIG_MFD_WM8944
ARRAY_SIZE(mdm9615_dai_ar8_wm8944)];
+#else
+ ARRAY_SIZE(mdm9615_dai_ar8_pri_pcm)];
#endif
/* Digital audio interface glue - connects codec <---> CPU */
@@ -5125,6 +5138,7 @@ static struct snd_soc_dai_link mdm9615_dai_mc7[] = {
#endif
+#ifdef CONFIG_WCD9304_CODEC
static struct snd_soc_dai_link mdm9615_i2s_dai[
ARRAY_SIZE(mdm9615_dai_common) +
ARRAY_SIZE(mdm9615_dai_i2s_tabla)];
@@ -5132,6 +5146,7 @@ static struct snd_soc_dai_link mdm9615_i2s_dai[
static struct snd_soc_dai_link mdm9615_slimbus_dai[
ARRAY_SIZE(mdm9615_dai_common) +
ARRAY_SIZE(mdm9615_dai_slimbus_tabla)];
+#endif
#if !defined(CONFIG_SIERRA_INTERNAL_CODEC)
static struct snd_soc_card snd_soc_card_mdm9615 = {
@@ -5180,17 +5195,21 @@ static int __init mdm9615_audio_init(void)
return -ENODEV ;
}
#if !defined(CONFIG_SIERRA_INTERNAL_CODEC) && !defined(CONFIG_SIERRA_EXTERNAL_CODEC)
+#ifdef CONFIG_WCD9310_CODEC
mbhc_cfg.calibration = def_tabla_mbhc_cal();
if (!mbhc_cfg.calibration) {
pr_err("Calibration data allocation failed\n");
return -ENOMEM;
}
#endif
+#endif
mdm9615_snd_device = platform_device_alloc("soc-audio", 0);
if (!mdm9615_snd_device) {
pr_err("Platform device allocation failed\n");
+#ifdef CONFIG_WCD9310_CODEC
kfree(mbhc_cfg.calibration);
+#endif
return -ENOMEM;
}
@@ -5203,7 +5222,7 @@ static int __init mdm9615_audio_init(void)
#endif
pr_info("%s(): Interface Type = %d\n", __func__, wcd9xxx_get_intf_type());
-#ifdef CONFIG_SND_SOC_WM8944
+#ifdef CONFIG_MFD_WM8944
else
pr_info("%s(): Interface Type (wm8944) = %d\n", __func__, wm8944_get_intf_type());
#endif
@@ -5221,7 +5240,6 @@ static int __init mdm9615_audio_init(void)
case BSWP85XX:
case BSWP8548:
pr_info("%s - AR8, AR755xRD and CF3 configuration\n", __func__);
-#if defined(CONFIG_MFD_WM8944)
memcpy(mdm9615_dai_ar8, mdm9615_dai_ar8_common,
sizeof(mdm9615_dai_ar8_common));
dai_links = ARRAY_SIZE(mdm9615_dai_ar8_common);
@@ -5231,6 +5249,7 @@ static int __init mdm9615_audio_init(void)
mdm9615_dai_ar8_sec_pcm, sizeof(mdm9615_dai_ar8_sec_pcm));
dai_links += ARRAY_SIZE(mdm9615_dai_ar8_sec_pcm);
}
+#if defined(CONFIG_MFD_WM8944)
if( wm8944_get_intf_type() > WM8944_INTERFACE_TYPE_NONE ) /* wm8944 was found */
{
snd_soc_card_mdm9615.name = "mdm9615-wm8944-snd-card";
@@ -5239,6 +5258,7 @@ static int __init mdm9615_audio_init(void)
dai_links += ARRAY_SIZE(mdm9615_dai_ar8_wm8944);
}
else
+#endif
{
snd_soc_card_mdm9615.name = "mdm9615-nocodec-snd-card";
memcpy(mdm9615_dai_ar8 + dai_links,
@@ -5247,7 +5267,6 @@ static int __init mdm9615_audio_init(void)
}
snd_soc_card_mdm9615.dai_link = mdm9615_dai_ar8;
snd_soc_card_mdm9615.num_links = dai_links;
-#endif
break;
case BSAR7550:
@@ -5286,6 +5305,7 @@ static int __init mdm9615_audio_init(void)
if (0)
{
#endif
+#ifdef CONFIG_WCD9304_CODEC
if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_SLIMBUS) {
memcpy(mdm9615_slimbus_dai, mdm9615_dai_common,
sizeof(mdm9615_dai_common));
@@ -5309,6 +5329,7 @@ static int __init mdm9615_audio_init(void)
snd_soc_card_mdm9615.num_links =
ARRAY_SIZE(mdm9615_dai_common);
}
+#endif
#if defined(CONFIG_SIERRA_INTERNAL_CODEC) || defined(CONFIG_SIERRA_EXTERNAL_CODEC)
}
#endif
@@ -5317,7 +5338,9 @@ static int __init mdm9615_audio_init(void)
ret = platform_device_add(mdm9615_snd_device);
if (ret) {
platform_device_put(mdm9615_snd_device);
+#ifdef CONFIG_WCD9310_CODEC
kfree(mbhc_cfg.calibration);
+#endif
return ret;
}
@@ -5346,7 +5369,9 @@ static void __exit mdm9615_audio_exit(void)
return ;
}
platform_device_unregister(mdm9615_snd_device);
+#ifdef CONFIG_WCD9310_CODEC
kfree(mbhc_cfg.calibration);
+#endif
iounmap(msm9x15_i2s_ctl.sif_virt_addr);
iounmap(msm9x15_i2s_ctl.spare_virt_addr);
iounmap(sif_virt_addr);
diff --git a/sound/soc/msm/msm-pcm-routing.c b/sound/soc/msm/msm-pcm-routing.c
index 5f46b52..8a752d8 100644
--- a/sound/soc/msm/msm-pcm-routing.c
+++ b/sound/soc/msm/msm-pcm-routing.c
@@ -1045,7 +1045,9 @@ static int msm_routing_ec_ref_rx_get(struct snd_kcontrol *kcontrol,
static int msm_routing_ec_ref_rx_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
+#ifdef CONFIG_SND_SOC_WM8944
extern void adm_ec_ref_rx_id(int port_id);
+#endif
switch (ucontrol->value.integer.value[0]) {
case 0:
@@ -1058,7 +1060,9 @@ static int msm_routing_ec_ref_rx_put(struct snd_kcontrol *kcontrol,
msm_route_ec_ref_rx = 0;
break;
}
+#ifdef CONFIG_SND_SOC_WM8944
adm_ec_ref_rx_id(msm_route_ec_ref_rx);
+#endif
pr_debug("%s: msm_route_ec_ref_rx = %d\n",
__func__, msm_route_ec_ref_rx);
return 0;