Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/clk.h> |
| 14 | #include <linux/delay.h> |
| 15 | #include <linux/gpio.h> |
| 16 | #include <linux/mfd/pm8xxx/pm8921.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/gpio.h> |
| 19 | #include <linux/mfd/pm8xxx/pm8921.h> |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 20 | #include <linux/slab.h> |
Neema Shetty | a58b9a2 | 2012-06-18 19:03:23 -0700 | [diff] [blame] | 21 | #include <linux/pm_runtime.h> |
| 22 | #include <linux/slimbus/slimbus.h> |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 23 | #include <sound/core.h> |
| 24 | #include <sound/soc.h> |
| 25 | #include <sound/soc-dapm.h> |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 26 | #include <sound/pcm.h> |
| 27 | #include <sound/jack.h> |
| 28 | #include <asm/mach-types.h> |
| 29 | #include <mach/socinfo.h> |
| 30 | #include "msm-pcm-routing.h" |
| 31 | #include "../codecs/wcd9310.h" |
| 32 | |
| 33 | /* 8064 machine driver */ |
| 34 | |
| 35 | #define PM8921_GPIO_BASE NR_GPIO_IRQS |
| 36 | #define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE) |
| 37 | |
| 38 | #define MSM8064_SPK_ON 1 |
| 39 | #define MSM8064_SPK_OFF 0 |
| 40 | |
| 41 | #define MSM_SLIM_0_RX_MAX_CHANNELS 2 |
| 42 | #define MSM_SLIM_0_TX_MAX_CHANNELS 4 |
| 43 | |
| 44 | #define BTSCO_RATE_8KHZ 8000 |
| 45 | #define BTSCO_RATE_16KHZ 16000 |
| 46 | |
| 47 | #define BOTTOM_SPK_AMP_POS 0x1 |
| 48 | #define BOTTOM_SPK_AMP_NEG 0x2 |
| 49 | #define TOP_SPK_AMP_POS 0x4 |
| 50 | #define TOP_SPK_AMP_NEG 0x8 |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 51 | #define TOP_SPK_AMP 0x10 |
| 52 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 53 | |
| 54 | #define GPIO_AUX_PCM_DOUT 43 |
| 55 | #define GPIO_AUX_PCM_DIN 44 |
| 56 | #define GPIO_AUX_PCM_SYNC 45 |
| 57 | #define GPIO_AUX_PCM_CLK 46 |
| 58 | |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 59 | #define TABLA_EXT_CLK_RATE 12288000 |
| 60 | |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 61 | #define TABLA_MBHC_DEF_BUTTONS 8 |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 62 | #define TABLA_MBHC_DEF_RLOADS 5 |
| 63 | |
Joonwoo Park | ca1516f | 2012-05-08 13:59:37 -0700 | [diff] [blame] | 64 | #define JACK_DETECT_GPIO 38 |
| 65 | |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 66 | /* Shared channel numbers for Slimbus ports that connect APQ to MDM. */ |
| 67 | enum { |
| 68 | SLIM_1_RX_1 = 145, /* BT-SCO and USB TX */ |
| 69 | SLIM_1_TX_1 = 146, /* BT-SCO and USB RX */ |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 70 | SLIM_3_RX_1 = 151, /* External echo-cancellation ref */ |
| 71 | SLIM_3_RX_2 = 152, /* External echo-cancellation ref */ |
Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 72 | SLIM_3_TX_1 = 153, /* HDMI RX */ |
| 73 | SLIM_3_TX_2 = 154, /* HDMI RX */ |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 74 | SLIM_4_TX_1 = 148, /* In-call recording RX */ |
| 75 | SLIM_4_TX_2 = 149, /* In-call recording RX */ |
| 76 | SLIM_4_RX_1 = 150, /* In-call music delivery TX */ |
| 77 | }; |
| 78 | |
| 79 | enum { |
| 80 | INCALL_REC_MONO, |
| 81 | INCALL_REC_STEREO, |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 82 | }; |
| 83 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 84 | static u32 top_spk_pamp_gpio = PM8921_GPIO_PM_TO_SYS(18); |
| 85 | static u32 bottom_spk_pamp_gpio = PM8921_GPIO_PM_TO_SYS(19); |
| 86 | static int msm_spk_control; |
| 87 | static int msm_ext_bottom_spk_pamp; |
| 88 | static int msm_ext_top_spk_pamp; |
| 89 | static int msm_slim_0_rx_ch = 1; |
| 90 | static int msm_slim_0_tx_ch = 1; |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 91 | static int msm_slim_3_rx_ch = 1; |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 92 | |
| 93 | static int msm_btsco_rate = BTSCO_RATE_8KHZ; |
| 94 | static int msm_btsco_ch = 1; |
| 95 | |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 96 | static int rec_mode = INCALL_REC_MONO; |
| 97 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 98 | static struct clk *codec_clk; |
| 99 | static int clk_users; |
| 100 | |
| 101 | static int msm_headset_gpios_configured; |
| 102 | |
| 103 | static struct snd_soc_jack hs_jack; |
| 104 | static struct snd_soc_jack button_jack; |
| 105 | |
Joonwoo Park | 2699870 | 2012-05-09 10:10:06 -0700 | [diff] [blame] | 106 | static int apq8064_hs_detect_use_gpio = -1; |
| 107 | module_param(apq8064_hs_detect_use_gpio, int, 0444); |
| 108 | MODULE_PARM_DESC(apq8064_hs_detect_use_gpio, "Use GPIO for headset detection"); |
| 109 | |
| 110 | static bool apq8064_hs_detect_use_firmware; |
| 111 | module_param(apq8064_hs_detect_use_firmware, bool, 0444); |
| 112 | MODULE_PARM_DESC(apq8064_hs_detect_use_firmware, "Use firmware for headset " |
| 113 | "detection"); |
Joonwoo Park | ca1516f | 2012-05-08 13:59:37 -0700 | [diff] [blame] | 114 | |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 115 | static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable, |
| 116 | bool dapm); |
| 117 | |
| 118 | static struct tabla_mbhc_config mbhc_cfg = { |
| 119 | .headset_jack = &hs_jack, |
| 120 | .button_jack = &button_jack, |
| 121 | .read_fw_bin = false, |
| 122 | .calibration = NULL, |
| 123 | .micbias = TABLA_MICBIAS2, |
| 124 | .mclk_cb_fn = msm_enable_codec_ext_clk, |
| 125 | .mclk_rate = TABLA_EXT_CLK_RATE, |
Joonwoo Park | ca1516f | 2012-05-08 13:59:37 -0700 | [diff] [blame] | 126 | .gpio = 0, |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 127 | .gpio_irq = 0, |
| 128 | .gpio_level_insert = 1, |
| 129 | }; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 130 | |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 131 | static struct mutex cdc_mclk_mutex; |
| 132 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 133 | static void msm_enable_ext_spk_amp_gpio(u32 spk_amp_gpio) |
| 134 | { |
| 135 | int ret = 0; |
| 136 | |
| 137 | struct pm_gpio param = { |
| 138 | .direction = PM_GPIO_DIR_OUT, |
| 139 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 140 | .output_value = 1, |
| 141 | .pull = PM_GPIO_PULL_NO, |
| 142 | .vin_sel = PM_GPIO_VIN_S4, |
| 143 | .out_strength = PM_GPIO_STRENGTH_MED, |
| 144 | . |
| 145 | function = PM_GPIO_FUNC_NORMAL, |
| 146 | }; |
| 147 | |
| 148 | if (spk_amp_gpio == bottom_spk_pamp_gpio) { |
| 149 | |
| 150 | ret = gpio_request(bottom_spk_pamp_gpio, "BOTTOM_SPK_AMP"); |
| 151 | if (ret) { |
| 152 | pr_err("%s: Error requesting BOTTOM SPK AMP GPIO %u\n", |
| 153 | __func__, bottom_spk_pamp_gpio); |
| 154 | return; |
| 155 | } |
| 156 | ret = pm8xxx_gpio_config(bottom_spk_pamp_gpio, ¶m); |
| 157 | if (ret) |
| 158 | pr_err("%s: Failed to configure Bottom Spk Ampl" |
| 159 | " gpio %u\n", __func__, bottom_spk_pamp_gpio); |
| 160 | else { |
| 161 | pr_debug("%s: enable Bottom spkr amp gpio\n", __func__); |
| 162 | gpio_direction_output(bottom_spk_pamp_gpio, 1); |
| 163 | } |
| 164 | |
| 165 | } else if (spk_amp_gpio == top_spk_pamp_gpio) { |
| 166 | |
| 167 | ret = gpio_request(top_spk_pamp_gpio, "TOP_SPK_AMP"); |
| 168 | if (ret) { |
| 169 | pr_err("%s: Error requesting GPIO %d\n", __func__, |
| 170 | top_spk_pamp_gpio); |
| 171 | return; |
| 172 | } |
| 173 | ret = pm8xxx_gpio_config(top_spk_pamp_gpio, ¶m); |
| 174 | if (ret) |
| 175 | pr_err("%s: Failed to configure Top Spk Ampl" |
| 176 | " gpio %u\n", __func__, top_spk_pamp_gpio); |
| 177 | else { |
| 178 | pr_debug("%s: enable Top spkr amp gpio\n", __func__); |
| 179 | gpio_direction_output(top_spk_pamp_gpio, 1); |
| 180 | } |
| 181 | } else { |
| 182 | pr_err("%s: ERROR : Invalid External Speaker Ampl GPIO." |
| 183 | " gpio = %u\n", __func__, spk_amp_gpio); |
| 184 | return; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | static void msm_ext_spk_power_amp_on(u32 spk) |
| 189 | { |
| 190 | if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) { |
| 191 | |
| 192 | if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) && |
| 193 | (msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) { |
| 194 | |
| 195 | pr_debug("%s() External Bottom Speaker Ampl already " |
| 196 | "turned on. spk = 0x%08x\n", __func__, spk); |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | msm_ext_bottom_spk_pamp |= spk; |
| 201 | |
| 202 | if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) && |
| 203 | (msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) { |
| 204 | |
| 205 | msm_enable_ext_spk_amp_gpio(bottom_spk_pamp_gpio); |
| 206 | pr_debug("%s: slepping 4 ms after turning on external " |
| 207 | " Bottom Speaker Ampl\n", __func__); |
| 208 | usleep_range(4000, 4000); |
| 209 | } |
| 210 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 211 | } else if (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG | TOP_SPK_AMP)) { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 212 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 213 | pr_debug("%s():top_spk_amp_state = 0x%x spk_event = 0x%x\n", |
| 214 | __func__, msm_ext_top_spk_pamp, spk); |
| 215 | |
| 216 | if (((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) && |
| 217 | (msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) || |
| 218 | (msm_ext_top_spk_pamp & TOP_SPK_AMP)) { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 219 | |
| 220 | pr_debug("%s() External Top Speaker Ampl already" |
| 221 | "turned on. spk = 0x%08x\n", __func__, spk); |
| 222 | return; |
| 223 | } |
| 224 | |
| 225 | msm_ext_top_spk_pamp |= spk; |
| 226 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 227 | if (((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) && |
| 228 | (msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) || |
| 229 | (msm_ext_top_spk_pamp & TOP_SPK_AMP)) { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 230 | |
| 231 | msm_enable_ext_spk_amp_gpio(top_spk_pamp_gpio); |
| 232 | pr_debug("%s: sleeping 4 ms after turning on " |
| 233 | " external Top Speaker Ampl\n", __func__); |
| 234 | usleep_range(4000, 4000); |
| 235 | } |
| 236 | } else { |
| 237 | |
| 238 | pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n", |
| 239 | __func__, spk); |
| 240 | return; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | static void msm_ext_spk_power_amp_off(u32 spk) |
| 245 | { |
| 246 | if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) { |
| 247 | |
| 248 | if (!msm_ext_bottom_spk_pamp) |
| 249 | return; |
| 250 | |
| 251 | gpio_direction_output(bottom_spk_pamp_gpio, 0); |
| 252 | gpio_free(bottom_spk_pamp_gpio); |
| 253 | msm_ext_bottom_spk_pamp = 0; |
| 254 | |
| 255 | pr_debug("%s: sleeping 4 ms after turning off external Bottom" |
| 256 | " Speaker Ampl\n", __func__); |
| 257 | |
| 258 | usleep_range(4000, 4000); |
| 259 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 260 | } else if (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG | TOP_SPK_AMP)) { |
| 261 | |
| 262 | pr_debug("%s: top_spk_amp_state = 0x%x spk_event = 0x%x\n", |
| 263 | __func__, msm_ext_top_spk_pamp, spk); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 264 | |
| 265 | if (!msm_ext_top_spk_pamp) |
| 266 | return; |
| 267 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 268 | if ((spk & TOP_SPK_AMP_POS) || (spk & TOP_SPK_AMP_NEG)) { |
| 269 | |
| 270 | msm_ext_top_spk_pamp &= (~(TOP_SPK_AMP_POS | |
| 271 | TOP_SPK_AMP_NEG)); |
| 272 | } else if (spk & TOP_SPK_AMP) { |
| 273 | msm_ext_top_spk_pamp &= ~TOP_SPK_AMP; |
| 274 | } |
| 275 | |
| 276 | if (msm_ext_top_spk_pamp) |
| 277 | return; |
| 278 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 279 | gpio_direction_output(top_spk_pamp_gpio, 0); |
| 280 | gpio_free(top_spk_pamp_gpio); |
| 281 | msm_ext_top_spk_pamp = 0; |
| 282 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 283 | pr_debug("%s: sleeping 4 ms after ext Top Spek Ampl is off\n", |
| 284 | __func__); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 285 | |
| 286 | usleep_range(4000, 4000); |
| 287 | } else { |
| 288 | |
| 289 | pr_err("%s: ERROR : Invalid Ext Spk Ampl. spk = 0x%08x\n", |
| 290 | __func__, spk); |
| 291 | return; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | static void msm_ext_control(struct snd_soc_codec *codec) |
| 296 | { |
| 297 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 298 | |
| 299 | pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control); |
| 300 | if (msm_spk_control == MSM8064_SPK_ON) { |
| 301 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos"); |
| 302 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg"); |
| 303 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos"); |
| 304 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg"); |
| 305 | } else { |
| 306 | snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Pos"); |
| 307 | snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Neg"); |
| 308 | snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Pos"); |
| 309 | snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Neg"); |
| 310 | } |
| 311 | |
| 312 | snd_soc_dapm_sync(dapm); |
| 313 | } |
| 314 | |
| 315 | static int msm_get_spk(struct snd_kcontrol *kcontrol, |
| 316 | struct snd_ctl_elem_value *ucontrol) |
| 317 | { |
| 318 | pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control); |
| 319 | ucontrol->value.integer.value[0] = msm_spk_control; |
| 320 | return 0; |
| 321 | } |
| 322 | static int msm_set_spk(struct snd_kcontrol *kcontrol, |
| 323 | struct snd_ctl_elem_value *ucontrol) |
| 324 | { |
| 325 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 326 | |
| 327 | pr_debug("%s()\n", __func__); |
| 328 | if (msm_spk_control == ucontrol->value.integer.value[0]) |
| 329 | return 0; |
| 330 | |
| 331 | msm_spk_control = ucontrol->value.integer.value[0]; |
| 332 | msm_ext_control(codec); |
| 333 | return 1; |
| 334 | } |
| 335 | static int msm_spkramp_event(struct snd_soc_dapm_widget *w, |
| 336 | struct snd_kcontrol *k, int event) |
| 337 | { |
| 338 | pr_debug("%s() %x\n", __func__, SND_SOC_DAPM_EVENT_ON(event)); |
| 339 | |
| 340 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
| 341 | if (!strncmp(w->name, "Ext Spk Bottom Pos", 18)) |
| 342 | msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_POS); |
| 343 | else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18)) |
| 344 | msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_NEG); |
| 345 | else if (!strncmp(w->name, "Ext Spk Top Pos", 15)) |
| 346 | msm_ext_spk_power_amp_on(TOP_SPK_AMP_POS); |
| 347 | else if (!strncmp(w->name, "Ext Spk Top Neg", 15)) |
| 348 | msm_ext_spk_power_amp_on(TOP_SPK_AMP_NEG); |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 349 | else if (!strncmp(w->name, "Ext Spk Top", 12)) |
| 350 | msm_ext_spk_power_amp_on(TOP_SPK_AMP); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 351 | else { |
| 352 | pr_err("%s() Invalid Speaker Widget = %s\n", |
| 353 | __func__, w->name); |
| 354 | return -EINVAL; |
| 355 | } |
| 356 | |
| 357 | } else { |
| 358 | if (!strncmp(w->name, "Ext Spk Bottom Pos", 18)) |
| 359 | msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_POS); |
| 360 | else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18)) |
| 361 | msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_NEG); |
| 362 | else if (!strncmp(w->name, "Ext Spk Top Pos", 15)) |
| 363 | msm_ext_spk_power_amp_off(TOP_SPK_AMP_POS); |
| 364 | else if (!strncmp(w->name, "Ext Spk Top Neg", 15)) |
| 365 | msm_ext_spk_power_amp_off(TOP_SPK_AMP_NEG); |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 366 | else if (!strncmp(w->name, "Ext Spk Top", 12)) |
| 367 | msm_ext_spk_power_amp_off(TOP_SPK_AMP); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 368 | else { |
| 369 | pr_err("%s() Invalid Speaker Widget = %s\n", |
| 370 | __func__, w->name); |
| 371 | return -EINVAL; |
| 372 | } |
| 373 | } |
| 374 | return 0; |
| 375 | } |
| 376 | |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 377 | static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable, |
| 378 | bool dapm) |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 379 | { |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 380 | int r = 0; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 381 | pr_debug("%s: enable = %d\n", __func__, enable); |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 382 | |
| 383 | mutex_lock(&cdc_mclk_mutex); |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 384 | if (enable) { |
| 385 | clk_users++; |
| 386 | pr_debug("%s: clk_users = %d\n", __func__, clk_users); |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 387 | if (clk_users == 1) { |
| 388 | if (codec_clk) { |
| 389 | clk_set_rate(codec_clk, TABLA_EXT_CLK_RATE); |
| 390 | clk_prepare_enable(codec_clk); |
| 391 | tabla_mclk_enable(codec, 1, dapm); |
| 392 | } else { |
| 393 | pr_err("%s: Error setting Tabla MCLK\n", |
| 394 | __func__); |
| 395 | clk_users--; |
| 396 | r = -EINVAL; |
| 397 | } |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 398 | } |
| 399 | } else { |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 400 | if (clk_users > 0) { |
| 401 | clk_users--; |
| 402 | pr_debug("%s: clk_users = %d\n", __func__, clk_users); |
| 403 | if (clk_users == 0) { |
| 404 | pr_debug("%s: disabling MCLK. clk_users = %d\n", |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 405 | __func__, clk_users); |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 406 | tabla_mclk_enable(codec, 0, dapm); |
| 407 | clk_disable_unprepare(codec_clk); |
| 408 | } |
| 409 | } else { |
| 410 | pr_err("%s: Error releasing Tabla MCLK\n", __func__); |
| 411 | r = -EINVAL; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 412 | } |
| 413 | } |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 414 | mutex_unlock(&cdc_mclk_mutex); |
| 415 | return r; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 416 | } |
| 417 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 418 | static int msm_mclk_event(struct snd_soc_dapm_widget *w, |
| 419 | struct snd_kcontrol *kcontrol, int event) |
| 420 | { |
| 421 | pr_debug("%s: event = %d\n", __func__, event); |
| 422 | |
| 423 | switch (event) { |
| 424 | case SND_SOC_DAPM_PRE_PMU: |
| 425 | |
| 426 | clk_users++; |
| 427 | pr_debug("%s: clk_users = %d\n", __func__, clk_users); |
| 428 | |
| 429 | if (clk_users != 1) |
| 430 | return 0; |
| 431 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 432 | if (codec_clk) { |
| 433 | clk_set_rate(codec_clk, 12288000); |
Asish Bhattacharya | 4776d96 | 2012-04-25 12:08:09 +0530 | [diff] [blame] | 434 | clk_prepare_enable(codec_clk); |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 435 | tabla_mclk_enable(w->codec, 1, true); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 436 | |
| 437 | } else { |
| 438 | pr_err("%s: Error setting Tabla MCLK\n", __func__); |
| 439 | clk_users--; |
| 440 | return -EINVAL; |
| 441 | } |
| 442 | break; |
| 443 | case SND_SOC_DAPM_POST_PMD: |
| 444 | |
| 445 | pr_debug("%s: clk_users = %d\n", __func__, clk_users); |
| 446 | |
| 447 | if (clk_users == 0) |
| 448 | return 0; |
| 449 | |
| 450 | clk_users--; |
| 451 | |
| 452 | if (!clk_users) { |
| 453 | pr_debug("%s: disabling MCLK. clk_users = %d\n", |
| 454 | __func__, clk_users); |
| 455 | |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 456 | tabla_mclk_enable(w->codec, 0, true); |
Asish Bhattacharya | 4776d96 | 2012-04-25 12:08:09 +0530 | [diff] [blame] | 457 | clk_disable_unprepare(codec_clk); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 458 | } |
| 459 | break; |
| 460 | } |
| 461 | return 0; |
| 462 | } |
| 463 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 464 | static const struct snd_soc_dapm_widget apq8064_dapm_widgets[] = { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 465 | |
| 466 | SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, |
| 467 | msm_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
| 468 | |
| 469 | SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", msm_spkramp_event), |
| 470 | SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", msm_spkramp_event), |
| 471 | |
| 472 | SND_SOC_DAPM_SPK("Ext Spk Top Pos", msm_spkramp_event), |
| 473 | SND_SOC_DAPM_SPK("Ext Spk Top Neg", msm_spkramp_event), |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 474 | SND_SOC_DAPM_SPK("Ext Spk Top", msm_spkramp_event), |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 475 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 476 | /************ Analog MICs ************/ |
| 477 | /** |
| 478 | * Analog mic7 (Front Top) on Liquid. |
| 479 | * Used as Handset mic on CDP. |
| 480 | */ |
| 481 | SND_SOC_DAPM_MIC("Analog mic7", NULL), |
| 482 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 483 | SND_SOC_DAPM_MIC("Headset Mic", NULL), |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 484 | SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL), |
| 485 | SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL), |
| 486 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 487 | /*********** Digital Mics ***************/ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 488 | SND_SOC_DAPM_MIC("Digital Mic1", NULL), |
| 489 | SND_SOC_DAPM_MIC("Digital Mic2", NULL), |
| 490 | SND_SOC_DAPM_MIC("Digital Mic3", NULL), |
| 491 | SND_SOC_DAPM_MIC("Digital Mic4", NULL), |
| 492 | SND_SOC_DAPM_MIC("Digital Mic5", NULL), |
| 493 | SND_SOC_DAPM_MIC("Digital Mic6", NULL), |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 494 | }; |
| 495 | |
Kiran Kandi | 323d710 | 2012-04-18 19:56:14 -0700 | [diff] [blame] | 496 | static const struct snd_soc_dapm_route apq8064_common_audio_map[] = { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 497 | |
| 498 | {"RX_BIAS", NULL, "MCLK"}, |
| 499 | {"LDO_H", NULL, "MCLK"}, |
| 500 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 501 | {"HEADPHONE", NULL, "LDO_H"}, |
| 502 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 503 | /* Speaker path */ |
| 504 | {"Ext Spk Bottom Pos", NULL, "LINEOUT1"}, |
| 505 | {"Ext Spk Bottom Neg", NULL, "LINEOUT3"}, |
| 506 | |
| 507 | {"Ext Spk Top Pos", NULL, "LINEOUT2"}, |
| 508 | {"Ext Spk Top Neg", NULL, "LINEOUT4"}, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 509 | {"Ext Spk Top", NULL, "LINEOUT5"}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 510 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 511 | /************ Analog MIC Paths ************/ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 512 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 513 | /* Headset Mic */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 514 | {"AMIC2", NULL, "MIC BIAS2 External"}, |
| 515 | {"MIC BIAS2 External", NULL, "Headset Mic"}, |
| 516 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 517 | /* Headset ANC microphones */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 518 | {"AMIC3", NULL, "MIC BIAS3 Internal1"}, |
| 519 | {"MIC BIAS3 Internal1", NULL, "ANCRight Headset Mic"}, |
| 520 | |
| 521 | {"AMIC4", NULL, "MIC BIAS1 Internal2"}, |
| 522 | {"MIC BIAS1 Internal2", NULL, "ANCLeft Headset Mic"}, |
Kiran Kandi | 323d710 | 2012-04-18 19:56:14 -0700 | [diff] [blame] | 523 | }; |
| 524 | |
| 525 | static const struct snd_soc_dapm_route apq8064_mtp_audio_map[] = { |
| 526 | |
| 527 | /************ Digital MIC Paths ************/ |
| 528 | |
| 529 | /* |
| 530 | * Digital Mic1 (Front bottom Left) on MTP. |
| 531 | * Conncted to DMIC1 Input on Tabla codec. |
| 532 | */ |
| 533 | {"DMIC1", NULL, "MIC BIAS1 External"}, |
| 534 | {"MIC BIAS1 External", NULL, "Digital Mic1"}, |
| 535 | |
| 536 | /** |
| 537 | * Digital Mic2 (Front bottom right) on MTP. |
| 538 | * Conncted to DMIC2 Input on Tabla codec. |
| 539 | */ |
| 540 | {"DMIC2", NULL, "MIC BIAS1 External"}, |
| 541 | {"MIC BIAS1 External", NULL, "Digital Mic2"}, |
| 542 | |
| 543 | /** |
| 544 | * Digital Mic3 (Back bottom) on MTP. |
| 545 | * Conncted to DMIC3 Input on Tabla codec. |
| 546 | */ |
| 547 | {"DMIC3", NULL, "MIC BIAS3 External"}, |
| 548 | {"MIC BIAS3 External", NULL, "Digital Mic3"}, |
| 549 | |
| 550 | /** |
| 551 | * Digital Mic4 (Back top) on MTP. |
| 552 | * Conncted to DMIC4 Input on Tabla codec. |
| 553 | */ |
| 554 | {"DMIC4", NULL, "MIC BIAS3 External"}, |
| 555 | {"MIC BIAS3 External", NULL, "Digital Mic4"}, |
| 556 | |
| 557 | /** |
| 558 | * Digital Mic5 (Top front Mic) on MTP. |
| 559 | * Conncted to DMIC6 Input on Tabla codec. |
| 560 | */ |
| 561 | {"DMIC6", NULL, "MIC BIAS4 External"}, |
| 562 | {"MIC BIAS4 External", NULL, "Digital Mic5"}, |
| 563 | |
| 564 | }; |
| 565 | |
| 566 | static const struct snd_soc_dapm_route apq8064_liquid_cdp_audio_map[] = { |
| 567 | |
| 568 | /************ Analog MIC Paths ************/ |
| 569 | /** |
| 570 | * Analog mic7 (Front Top Mic) on Liquid. |
| 571 | * Used as Handset mic on CDP. |
| 572 | * Not there on MTP. |
| 573 | */ |
| 574 | {"AMIC1", NULL, "MIC BIAS1 External"}, |
| 575 | {"MIC BIAS1 External", NULL, "Analog mic7"}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 576 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 577 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 578 | /************ Digital MIC Paths ************/ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 579 | /** |
| 580 | * The digital Mic routes are setup considering |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 581 | * Liquid as default device. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 582 | */ |
| 583 | |
| 584 | /** |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 585 | * Digital Mic1 (Front bottom left corner) on Liquid. |
| 586 | * Digital Mic2 (Front bottom right) on MTP. |
| 587 | * Digital Mic GM1 on CDP mainboard. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 588 | * Conncted to DMIC2 Input on Tabla codec. |
| 589 | */ |
| 590 | {"DMIC2", NULL, "MIC BIAS1 External"}, |
| 591 | {"MIC BIAS1 External", NULL, "Digital Mic1"}, |
| 592 | |
| 593 | /** |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 594 | * Digital Mic2 (Front left side) on Liquid. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 595 | * Digital Mic GM2 on CDP mainboard. |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 596 | * Not there on MTP. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 597 | * Conncted to DMIC3 Input on Tabla codec. |
| 598 | */ |
| 599 | {"DMIC3", NULL, "MIC BIAS3 External"}, |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 600 | {"MIC BIAS3 External", NULL, "Digital Mic2"}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 601 | |
| 602 | /** |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 603 | * Digital Mic3. Front bottom left of middle on Liquid. |
| 604 | * Digital Mic5 (Top front Mic) on MTP. |
| 605 | * Digital Mic GM5 on CDP mainboard. |
| 606 | * Conncted to DMIC6 Input on Tabla codec. |
| 607 | */ |
| 608 | {"DMIC6", NULL, "MIC BIAS4 External"}, |
| 609 | {"MIC BIAS4 External", NULL, "Digital Mic3"}, |
| 610 | |
| 611 | /** |
| 612 | * Digital Mic4. Back bottom on Liquid. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 613 | * Digital Mic GM3 on CDP mainboard. |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 614 | * Top Front Mic on MTP. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 615 | * Conncted to DMIC5 Input on Tabla codec. |
| 616 | */ |
| 617 | {"DMIC5", NULL, "MIC BIAS4 External"}, |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 618 | {"MIC BIAS4 External", NULL, "Digital Mic4"}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 619 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 620 | /** |
| 621 | * Digital Mic5. Front bottom right of middle on Liquid. |
| 622 | * Digital Mic GM6 on CDP mainboard. |
| 623 | * Not there on MTP. |
| 624 | * Conncted to DMIC4 Input on Tabla codec. |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 625 | */ |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 626 | {"DMIC4", NULL, "MIC BIAS3 External"}, |
| 627 | {"MIC BIAS3 External", NULL, "Digital Mic5"}, |
| 628 | |
| 629 | /* Digital Mic6 (Front bottom right corner) on Liquid. |
| 630 | * Digital Mic1 (Front bottom Left) on MTP. |
| 631 | * Digital Mic GM4 on CDP. |
| 632 | * Conncted to DMIC1 Input on Tabla codec. |
| 633 | */ |
| 634 | {"DMIC1", NULL, "MIC BIAS1 External"}, |
| 635 | {"MIC BIAS1 External", NULL, "Digital Mic6"}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 636 | }; |
| 637 | |
| 638 | static const char *spk_function[] = {"Off", "On"}; |
| 639 | static const char *slim0_rx_ch_text[] = {"One", "Two"}; |
| 640 | static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"}; |
| 641 | |
| 642 | static const struct soc_enum msm_enum[] = { |
| 643 | SOC_ENUM_SINGLE_EXT(2, spk_function), |
| 644 | SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text), |
| 645 | SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text), |
| 646 | }; |
| 647 | |
| 648 | static const char *btsco_rate_text[] = {"8000", "16000"}; |
| 649 | static const struct soc_enum msm_btsco_enum[] = { |
| 650 | SOC_ENUM_SINGLE_EXT(2, btsco_rate_text), |
| 651 | }; |
| 652 | |
| 653 | static int msm_slim_0_rx_ch_get(struct snd_kcontrol *kcontrol, |
| 654 | struct snd_ctl_elem_value *ucontrol) |
| 655 | { |
| 656 | pr_debug("%s: msm_slim_0_rx_ch = %d\n", __func__, |
| 657 | msm_slim_0_rx_ch); |
| 658 | ucontrol->value.integer.value[0] = msm_slim_0_rx_ch - 1; |
| 659 | return 0; |
| 660 | } |
| 661 | |
| 662 | static int msm_slim_0_rx_ch_put(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_value *ucontrol) |
| 664 | { |
| 665 | msm_slim_0_rx_ch = ucontrol->value.integer.value[0] + 1; |
| 666 | |
| 667 | pr_debug("%s: msm_slim_0_rx_ch = %d\n", __func__, |
| 668 | msm_slim_0_rx_ch); |
| 669 | return 1; |
| 670 | } |
| 671 | |
| 672 | static int msm_slim_0_tx_ch_get(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_value *ucontrol) |
| 674 | { |
| 675 | pr_debug("%s: msm_slim_0_tx_ch = %d\n", __func__, |
| 676 | msm_slim_0_tx_ch); |
| 677 | ucontrol->value.integer.value[0] = msm_slim_0_tx_ch - 1; |
| 678 | return 0; |
| 679 | } |
| 680 | |
| 681 | static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol, |
| 682 | struct snd_ctl_elem_value *ucontrol) |
| 683 | { |
| 684 | msm_slim_0_tx_ch = ucontrol->value.integer.value[0] + 1; |
| 685 | |
| 686 | pr_debug("%s: msm_slim_0_tx_ch = %d\n", __func__, |
| 687 | msm_slim_0_tx_ch); |
| 688 | return 1; |
| 689 | } |
| 690 | |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 691 | static int msm_slim_3_rx_ch_get(struct snd_kcontrol *kcontrol, |
| 692 | struct snd_ctl_elem_value *ucontrol) |
| 693 | { |
| 694 | pr_debug("%s: msm_slim_3_rx_ch = %d\n", __func__, |
| 695 | msm_slim_3_rx_ch); |
| 696 | ucontrol->value.integer.value[0] = msm_slim_3_rx_ch - 1; |
| 697 | return 0; |
| 698 | } |
| 699 | |
| 700 | static int msm_slim_3_rx_ch_put(struct snd_kcontrol *kcontrol, |
| 701 | struct snd_ctl_elem_value *ucontrol) |
| 702 | { |
| 703 | msm_slim_3_rx_ch = ucontrol->value.integer.value[0] + 1; |
| 704 | |
| 705 | pr_debug("%s: msm_slim_3_rx_ch = %d\n", __func__, |
| 706 | msm_slim_3_rx_ch); |
| 707 | return 1; |
| 708 | } |
| 709 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 710 | static int msm_btsco_rate_get(struct snd_kcontrol *kcontrol, |
| 711 | struct snd_ctl_elem_value *ucontrol) |
| 712 | { |
| 713 | pr_debug("%s: msm_btsco_rate = %d", __func__, |
| 714 | msm_btsco_rate); |
| 715 | ucontrol->value.integer.value[0] = msm_btsco_rate; |
| 716 | return 0; |
| 717 | } |
| 718 | |
| 719 | static int msm_btsco_rate_put(struct snd_kcontrol *kcontrol, |
| 720 | struct snd_ctl_elem_value *ucontrol) |
| 721 | { |
| 722 | switch (ucontrol->value.integer.value[0]) { |
| 723 | case 0: |
| 724 | msm_btsco_rate = BTSCO_RATE_8KHZ; |
| 725 | break; |
| 726 | case 1: |
| 727 | msm_btsco_rate = BTSCO_RATE_16KHZ; |
| 728 | break; |
| 729 | default: |
| 730 | msm_btsco_rate = BTSCO_RATE_8KHZ; |
| 731 | break; |
| 732 | } |
| 733 | pr_debug("%s: msm_btsco_rate = %d\n", __func__, |
| 734 | msm_btsco_rate); |
| 735 | return 0; |
| 736 | } |
| 737 | |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 738 | static int msm_incall_rec_mode_get(struct snd_kcontrol *kcontrol, |
| 739 | struct snd_ctl_elem_value *ucontrol) |
| 740 | { |
| 741 | ucontrol->value.integer.value[0] = rec_mode; |
| 742 | return 0; |
| 743 | } |
| 744 | |
| 745 | static int msm_incall_rec_mode_put(struct snd_kcontrol *kcontrol, |
| 746 | struct snd_ctl_elem_value *ucontrol) |
| 747 | { |
| 748 | |
| 749 | rec_mode = ucontrol->value.integer.value[0]; |
| 750 | pr_debug("%s: rec_mode:%d\n", __func__, rec_mode); |
| 751 | |
| 752 | return 0; |
| 753 | } |
| 754 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 755 | static const struct snd_kcontrol_new tabla_msm_controls[] = { |
| 756 | SOC_ENUM_EXT("Speaker Function", msm_enum[0], msm_get_spk, |
| 757 | msm_set_spk), |
| 758 | SOC_ENUM_EXT("SLIM_0_RX Channels", msm_enum[1], |
| 759 | msm_slim_0_rx_ch_get, msm_slim_0_rx_ch_put), |
| 760 | SOC_ENUM_EXT("SLIM_0_TX Channels", msm_enum[2], |
| 761 | msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put), |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 762 | SOC_ENUM_EXT("Internal BTSCO SampleRate", msm_btsco_enum[0], |
| 763 | msm_btsco_rate_get, msm_btsco_rate_put), |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 764 | SOC_SINGLE_EXT("Incall Rec Mode", SND_SOC_NOPM, 0, 1, 0, |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 765 | msm_incall_rec_mode_get, msm_incall_rec_mode_put), |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 766 | SOC_ENUM_EXT("SLIM_3_RX Channels", msm_enum[1], |
| 767 | msm_slim_3_rx_ch_get, msm_slim_3_rx_ch_put), |
| 768 | }; |
| 769 | |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 770 | static void *def_tabla_mbhc_cal(void) |
| 771 | { |
| 772 | void *tabla_cal; |
| 773 | struct tabla_mbhc_btn_detect_cfg *btn_cfg; |
| 774 | u16 *btn_low, *btn_high; |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 775 | u8 *n_ready, *n_cic, *gain; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 776 | |
| 777 | tabla_cal = kzalloc(TABLA_MBHC_CAL_SIZE(TABLA_MBHC_DEF_BUTTONS, |
| 778 | TABLA_MBHC_DEF_RLOADS), |
| 779 | GFP_KERNEL); |
| 780 | if (!tabla_cal) { |
| 781 | pr_err("%s: out of memory\n", __func__); |
| 782 | return NULL; |
| 783 | } |
| 784 | |
| 785 | #define S(X, Y) ((TABLA_MBHC_CAL_GENERAL_PTR(tabla_cal)->X) = (Y)) |
| 786 | S(t_ldoh, 100); |
| 787 | S(t_bg_fast_settle, 100); |
| 788 | S(t_shutdown_plug_rem, 255); |
| 789 | S(mbhc_nsa, 4); |
| 790 | S(mbhc_navg, 4); |
| 791 | #undef S |
| 792 | #define S(X, Y) ((TABLA_MBHC_CAL_PLUG_DET_PTR(tabla_cal)->X) = (Y)) |
| 793 | S(mic_current, TABLA_PID_MIC_5_UA); |
| 794 | S(hph_current, TABLA_PID_MIC_5_UA); |
| 795 | S(t_mic_pid, 100); |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 796 | S(t_ins_complete, 250); |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 797 | S(t_ins_retry, 200); |
| 798 | #undef S |
| 799 | #define S(X, Y) ((TABLA_MBHC_CAL_PLUG_TYPE_PTR(tabla_cal)->X) = (Y)) |
| 800 | S(v_no_mic, 30); |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 801 | S(v_hs_max, 1550); |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 802 | #undef S |
| 803 | #define S(X, Y) ((TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal)->X) = (Y)) |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 804 | S(c[0], 62); |
| 805 | S(c[1], 124); |
| 806 | S(nc, 1); |
| 807 | S(n_meas, 3); |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 808 | S(mbhc_nsc, 11); |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 809 | S(n_btn_meas, 1); |
| 810 | S(n_btn_con, 2); |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 811 | S(num_btn, TABLA_MBHC_DEF_BUTTONS); |
| 812 | S(v_btn_press_delta_sta, 100); |
| 813 | S(v_btn_press_delta_cic, 50); |
| 814 | #undef S |
| 815 | btn_cfg = TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal); |
| 816 | btn_low = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_LOW); |
| 817 | btn_high = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_HIGH); |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 818 | btn_low[0] = -50; |
| 819 | btn_high[0] = 10; |
| 820 | btn_low[1] = 11; |
| 821 | btn_high[1] = 38; |
| 822 | btn_low[2] = 39; |
| 823 | btn_high[2] = 64; |
| 824 | btn_low[3] = 65; |
| 825 | btn_high[3] = 91; |
| 826 | btn_low[4] = 92; |
| 827 | btn_high[4] = 115; |
| 828 | btn_low[5] = 116; |
| 829 | btn_high[5] = 141; |
| 830 | btn_low[6] = 142; |
| 831 | btn_high[6] = 163; |
| 832 | btn_low[7] = 164; |
| 833 | btn_high[7] = 250; |
| 834 | n_ready = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_READY); |
| 835 | n_ready[0] = 48; |
| 836 | n_ready[1] = 38; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 837 | n_cic = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_CIC); |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 838 | n_cic[0] = 60; |
| 839 | n_cic[1] = 47; |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 840 | gain = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_GAIN); |
| 841 | gain[0] = 11; |
| 842 | gain[1] = 9; |
| 843 | |
| 844 | return tabla_cal; |
| 845 | } |
| 846 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 847 | static int msm_hw_params(struct snd_pcm_substream *substream, |
| 848 | struct snd_pcm_hw_params *params) |
| 849 | { |
| 850 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 851 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 852 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 853 | int ret = 0; |
| 854 | unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS]; |
| 855 | unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0; |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 856 | unsigned int num_tx_ch = 0; |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 857 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 858 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 859 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 860 | |
| 861 | pr_debug("%s: rx_0_ch=%d\n", __func__, msm_slim_0_rx_ch); |
| 862 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 863 | ret = snd_soc_dai_get_channel_map(codec_dai, |
| 864 | &tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch); |
| 865 | if (ret < 0) { |
| 866 | pr_err("%s: failed to get codec chan map\n", __func__); |
| 867 | goto end; |
| 868 | } |
| 869 | |
| 870 | ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0, |
| 871 | msm_slim_0_rx_ch, rx_ch); |
| 872 | if (ret < 0) { |
| 873 | pr_err("%s: failed to set cpu chan map\n", __func__); |
| 874 | goto end; |
| 875 | } |
| 876 | ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0, |
| 877 | msm_slim_0_rx_ch, rx_ch); |
| 878 | if (ret < 0) { |
| 879 | pr_err("%s: failed to set codec channel map\n", |
| 880 | __func__); |
| 881 | goto end; |
| 882 | } |
| 883 | } else { |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 884 | |
| 885 | if (codec_dai->id == 2) |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 886 | num_tx_ch = msm_slim_0_tx_ch; |
Neema Shetty | e5cae8e | 2012-04-27 18:07:37 -0700 | [diff] [blame] | 887 | else if (codec_dai->id == 5) { |
| 888 | /* DAI 5 is used for external EC reference from codec. |
| 889 | * Since Rx is fed as reference for EC, the config of |
| 890 | * this DAI is based on that of the Rx path. |
| 891 | */ |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 892 | num_tx_ch = msm_slim_0_rx_ch; |
Neema Shetty | e5cae8e | 2012-04-27 18:07:37 -0700 | [diff] [blame] | 893 | } |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 894 | |
| 895 | pr_debug("%s: %s_tx_dai_id_%d_ch=%d\n", __func__, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 896 | codec_dai->name, codec_dai->id, num_tx_ch); |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 897 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 898 | ret = snd_soc_dai_get_channel_map(codec_dai, |
| 899 | &tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch); |
| 900 | if (ret < 0) { |
| 901 | pr_err("%s: failed to get codec chan map\n", __func__); |
| 902 | goto end; |
| 903 | } |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 904 | |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 905 | ret = snd_soc_dai_set_channel_map(cpu_dai, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 906 | num_tx_ch, tx_ch, 0 , 0); |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 907 | if (ret < 0) { |
| 908 | pr_err("%s: failed to set cpu chan map\n", __func__); |
| 909 | goto end; |
| 910 | } |
| 911 | ret = snd_soc_dai_set_channel_map(codec_dai, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 912 | num_tx_ch, tx_ch, 0, 0); |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 913 | if (ret < 0) { |
| 914 | pr_err("%s: failed to set codec channel map\n", |
| 915 | __func__); |
| 916 | goto end; |
| 917 | } |
| 918 | |
| 919 | |
| 920 | } |
| 921 | end: |
| 922 | return ret; |
| 923 | } |
| 924 | |
Helen Zeng | f3b17fb | 2012-02-28 15:07:38 -0800 | [diff] [blame] | 925 | static int msm_stubrx_init(struct snd_soc_pcm_runtime *rtd) |
| 926 | { |
| 927 | rtd->pmdown_time = 0; |
| 928 | |
| 929 | return 0; |
| 930 | } |
| 931 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 932 | static int msm_slimbus_2_hw_params(struct snd_pcm_substream *substream, |
| 933 | struct snd_pcm_hw_params *params) |
| 934 | { |
| 935 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 936 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 937 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 938 | int ret = 0; |
| 939 | unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS]; |
| 940 | unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0; |
| 941 | unsigned int num_tx_ch = 0; |
| 942 | unsigned int num_rx_ch = 0; |
| 943 | |
| 944 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 945 | |
| 946 | num_rx_ch = params_channels(params); |
| 947 | |
| 948 | pr_debug("%s: %s rx_dai_id = %d num_ch = %d\n", __func__, |
| 949 | codec_dai->name, codec_dai->id, num_rx_ch); |
| 950 | |
| 951 | ret = snd_soc_dai_get_channel_map(codec_dai, |
| 952 | &tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch); |
| 953 | if (ret < 0) { |
| 954 | pr_err("%s: failed to get codec chan map\n", __func__); |
| 955 | goto end; |
| 956 | } |
| 957 | |
| 958 | ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0, |
| 959 | num_rx_ch, rx_ch); |
| 960 | if (ret < 0) { |
| 961 | pr_err("%s: failed to set cpu chan map\n", __func__); |
| 962 | goto end; |
| 963 | } |
| 964 | ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0, |
| 965 | num_rx_ch, rx_ch); |
| 966 | if (ret < 0) { |
| 967 | pr_err("%s: failed to set codec channel map\n", |
| 968 | __func__); |
| 969 | goto end; |
| 970 | } |
| 971 | } else { |
| 972 | |
| 973 | num_tx_ch = params_channels(params); |
| 974 | |
| 975 | pr_debug("%s: %s tx_dai_id = %d num_ch = %d\n", __func__, |
| 976 | codec_dai->name, codec_dai->id, num_tx_ch); |
| 977 | |
| 978 | ret = snd_soc_dai_get_channel_map(codec_dai, |
| 979 | &tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch); |
| 980 | if (ret < 0) { |
| 981 | pr_err("%s: failed to get codec chan map\n", __func__); |
| 982 | goto end; |
| 983 | } |
| 984 | |
| 985 | ret = snd_soc_dai_set_channel_map(cpu_dai, |
| 986 | num_tx_ch, tx_ch, 0 , 0); |
| 987 | if (ret < 0) { |
| 988 | pr_err("%s: failed to set cpu chan map\n", __func__); |
| 989 | goto end; |
| 990 | } |
| 991 | ret = snd_soc_dai_set_channel_map(codec_dai, |
| 992 | num_tx_ch, tx_ch, 0, 0); |
| 993 | if (ret < 0) { |
| 994 | pr_err("%s: failed to set codec channel map\n", |
| 995 | __func__); |
| 996 | goto end; |
| 997 | } |
| 998 | } |
| 999 | end: |
| 1000 | return ret; |
| 1001 | } |
| 1002 | |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1003 | static int msm_slimbus_1_hw_params(struct snd_pcm_substream *substream, |
| 1004 | struct snd_pcm_hw_params *params) |
| 1005 | { |
| 1006 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 1007 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 1008 | int ret = 0; |
| 1009 | unsigned int rx_ch = SLIM_1_RX_1, tx_ch = SLIM_1_TX_1; |
| 1010 | |
| 1011 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 1012 | pr_debug("%s: APQ BT/USB TX -> SLIMBUS_1_RX -> MDM TX shared ch %d\n", |
| 1013 | __func__, rx_ch); |
| 1014 | |
| 1015 | ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0, 1, &rx_ch); |
| 1016 | if (ret < 0) { |
| 1017 | pr_err("%s: Erorr %d setting SLIM_1 RX channel map\n", |
| 1018 | __func__, ret); |
| 1019 | |
| 1020 | goto end; |
| 1021 | } |
| 1022 | } else { |
| 1023 | pr_debug("%s: MDM RX -> SLIMBUS_1_TX -> APQ BT/USB Rx shared ch %d\n", |
| 1024 | __func__, tx_ch); |
| 1025 | |
| 1026 | ret = snd_soc_dai_set_channel_map(cpu_dai, 1, &tx_ch, 0, 0); |
| 1027 | if (ret < 0) { |
| 1028 | pr_err("%s: Erorr %d setting SLIM_1 TX channel map\n", |
| 1029 | __func__, ret); |
| 1030 | |
| 1031 | goto end; |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | end: |
| 1036 | return ret; |
| 1037 | } |
| 1038 | |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1039 | static int msm_slimbus_3_hw_params(struct snd_pcm_substream *substream, |
| 1040 | struct snd_pcm_hw_params *params) |
| 1041 | { |
| 1042 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 1043 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 1044 | int ret = 0; |
| 1045 | unsigned int rx_ch[2] = {SLIM_3_RX_1, SLIM_3_RX_2}; |
Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 1046 | unsigned int tx_ch[2] = {SLIM_3_TX_1, SLIM_3_TX_2}; |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1047 | |
| 1048 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 1049 | pr_debug("%s: slim_3_rx_ch %d, sch %d %d\n", |
| 1050 | __func__, msm_slim_3_rx_ch, |
| 1051 | rx_ch[0], rx_ch[1]); |
| 1052 | |
| 1053 | ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0, |
| 1054 | msm_slim_3_rx_ch, rx_ch); |
| 1055 | if (ret < 0) { |
| 1056 | pr_err("%s: Erorr %d setting SLIM_3 RX channel map\n", |
| 1057 | __func__, ret); |
| 1058 | |
| 1059 | goto end; |
| 1060 | } |
| 1061 | } else { |
Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 1062 | pr_debug("%s: MDM RX -> SLIMBUS_3_TX -> APQ HDMI ch: %d, %d\n", |
| 1063 | __func__, tx_ch[0], tx_ch[1]); |
| 1064 | |
| 1065 | ret = snd_soc_dai_set_channel_map(cpu_dai, 2, tx_ch, 0, 0); |
| 1066 | if (ret < 0) { |
| 1067 | pr_err("%s: Erorr %d setting SLIM_3 TX channel map\n", |
| 1068 | __func__, ret); |
| 1069 | |
| 1070 | goto end; |
| 1071 | } |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1072 | } |
| 1073 | |
| 1074 | end: |
| 1075 | return ret; |
| 1076 | } |
| 1077 | |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1078 | static int msm_slimbus_4_hw_params(struct snd_pcm_substream *substream, |
| 1079 | struct snd_pcm_hw_params *params) |
| 1080 | { |
| 1081 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 1082 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 1083 | int ret = 0; |
| 1084 | unsigned int rx_ch = SLIM_4_RX_1, tx_ch[2]; |
| 1085 | |
| 1086 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 1087 | pr_debug("%s: APQ Incall Playback SLIMBUS_4_RX -> MDM TX shared ch %d\n", |
| 1088 | __func__, rx_ch); |
| 1089 | |
| 1090 | ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0, 1, &rx_ch); |
| 1091 | if (ret < 0) { |
| 1092 | pr_err("%s: Erorr %d setting SLIM_4 RX channel map\n", |
| 1093 | __func__, ret); |
| 1094 | |
| 1095 | } |
| 1096 | } else { |
| 1097 | if (rec_mode == INCALL_REC_STEREO) { |
| 1098 | tx_ch[0] = SLIM_4_TX_1; |
| 1099 | tx_ch[1] = SLIM_4_TX_2; |
| 1100 | ret = snd_soc_dai_set_channel_map(cpu_dai, 2, |
| 1101 | tx_ch, 0, 0); |
| 1102 | } else { |
| 1103 | tx_ch[0] = SLIM_4_TX_1; |
| 1104 | ret = snd_soc_dai_set_channel_map(cpu_dai, 1, |
| 1105 | tx_ch, 0, 0); |
| 1106 | } |
| 1107 | pr_debug("%s: Incall Record shared tx_ch[0]:%d, tx_ch[1]:%d\n", |
| 1108 | __func__, tx_ch[0], tx_ch[1]); |
| 1109 | |
| 1110 | if (ret < 0) { |
| 1111 | pr_err("%s: Erorr %d setting SLIM_4 TX channel map\n", |
| 1112 | __func__, ret); |
| 1113 | |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | return ret; |
| 1118 | } |
| 1119 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1120 | static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) |
| 1121 | { |
| 1122 | int err; |
Joonwoo Park | 2699870 | 2012-05-09 10:10:06 -0700 | [diff] [blame] | 1123 | uint32_t revision; |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1124 | struct snd_soc_codec *codec = rtd->codec; |
| 1125 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
Kuirong Wang | a9c3acc | 2012-02-09 17:00:45 -0800 | [diff] [blame] | 1126 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1127 | |
Kuirong Wang | a9c3acc | 2012-02-09 17:00:45 -0800 | [diff] [blame] | 1128 | pr_debug("%s(), dev_name%s\n", __func__, dev_name(cpu_dai->dev)); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1129 | |
| 1130 | /*if (machine_is_msm_liquid()) { |
| 1131 | top_spk_pamp_gpio = (PM8921_GPIO_PM_TO_SYS(19)); |
| 1132 | bottom_spk_pamp_gpio = (PM8921_GPIO_PM_TO_SYS(18)); |
| 1133 | }*/ |
| 1134 | |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 1135 | snd_soc_dapm_new_controls(dapm, apq8064_dapm_widgets, |
| 1136 | ARRAY_SIZE(apq8064_dapm_widgets)); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1137 | |
Kiran Kandi | 323d710 | 2012-04-18 19:56:14 -0700 | [diff] [blame] | 1138 | snd_soc_dapm_add_routes(dapm, apq8064_common_audio_map, |
| 1139 | ARRAY_SIZE(apq8064_common_audio_map)); |
| 1140 | |
| 1141 | if (machine_is_apq8064_mtp()) { |
| 1142 | snd_soc_dapm_add_routes(dapm, apq8064_mtp_audio_map, |
| 1143 | ARRAY_SIZE(apq8064_mtp_audio_map)); |
| 1144 | } else { |
| 1145 | snd_soc_dapm_add_routes(dapm, apq8064_liquid_cdp_audio_map, |
| 1146 | ARRAY_SIZE(apq8064_liquid_cdp_audio_map)); |
| 1147 | } |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1148 | |
| 1149 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos"); |
| 1150 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg"); |
| 1151 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos"); |
| 1152 | snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg"); |
| 1153 | |
| 1154 | snd_soc_dapm_sync(dapm); |
| 1155 | |
| 1156 | err = snd_soc_jack_new(codec, "Headset Jack", |
| 1157 | (SND_JACK_HEADSET | SND_JACK_OC_HPHL | SND_JACK_OC_HPHR), |
| 1158 | &hs_jack); |
| 1159 | if (err) { |
| 1160 | pr_err("failed to create new jack\n"); |
| 1161 | return err; |
| 1162 | } |
| 1163 | |
| 1164 | err = snd_soc_jack_new(codec, "Button Jack", |
Swaminathan Sathappan | 4ea7f1a0 | 2012-02-29 12:55:55 -0800 | [diff] [blame] | 1165 | TABLA_JACK_BUTTON_MASK, &button_jack); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1166 | if (err) { |
| 1167 | pr_err("failed to create new jack\n"); |
| 1168 | return err; |
| 1169 | } |
| 1170 | |
Kuirong Wang | a9c3acc | 2012-02-09 17:00:45 -0800 | [diff] [blame] | 1171 | codec_clk = clk_get(cpu_dai->dev, "osr_clk"); |
| 1172 | |
Joonwoo Park | 2699870 | 2012-05-09 10:10:06 -0700 | [diff] [blame] | 1173 | /* APQ8064 Rev 1.1 CDP and Liquid have mechanical switch */ |
| 1174 | revision = socinfo_get_version(); |
| 1175 | if (apq8064_hs_detect_use_gpio != -1) { |
| 1176 | if (apq8064_hs_detect_use_gpio == 1) |
| 1177 | pr_debug("%s: MBHC mechanical is enabled by request\n", |
| 1178 | __func__); |
| 1179 | else if (apq8064_hs_detect_use_gpio == 0) |
| 1180 | pr_debug("%s: MBHC mechanical is disabled by request\n", |
| 1181 | __func__); |
| 1182 | else |
| 1183 | pr_warn("%s: Invalid hs_detect_use_gpio %d\n", __func__, |
| 1184 | apq8064_hs_detect_use_gpio); |
| 1185 | } else if (SOCINFO_VERSION_MAJOR(revision) == 0) { |
| 1186 | pr_warn("%s: Unknown HW revision detected %d.%d\n", __func__, |
| 1187 | SOCINFO_VERSION_MAJOR(revision), |
| 1188 | SOCINFO_VERSION_MINOR(revision)); |
| 1189 | } else if ((SOCINFO_VERSION_MAJOR(revision) == 1 && |
| 1190 | SOCINFO_VERSION_MINOR(revision) >= 1 && |
| 1191 | (machine_is_apq8064_cdp() || |
| 1192 | machine_is_apq8064_liquid())) || |
| 1193 | SOCINFO_VERSION_MAJOR(revision) > 1) { |
| 1194 | pr_debug("%s: MBHC mechanical switch available APQ8064 " |
| 1195 | "detected\n", __func__); |
| 1196 | apq8064_hs_detect_use_gpio = 1; |
| 1197 | } |
| 1198 | |
| 1199 | if (apq8064_hs_detect_use_gpio == 1) { |
| 1200 | pr_debug("%s: Using MBHC mechanical switch\n", __func__); |
Joonwoo Park | ca1516f | 2012-05-08 13:59:37 -0700 | [diff] [blame] | 1201 | mbhc_cfg.gpio = JACK_DETECT_GPIO; |
| 1202 | mbhc_cfg.gpio_irq = gpio_to_irq(JACK_DETECT_GPIO); |
| 1203 | err = gpio_request(mbhc_cfg.gpio, "MBHC_HS_DETECT"); |
| 1204 | if (err < 0) { |
| 1205 | pr_err("%s: gpio_request %d failed %d\n", __func__, |
| 1206 | mbhc_cfg.gpio, err); |
| 1207 | return err; |
| 1208 | } |
| 1209 | gpio_direction_input(JACK_DETECT_GPIO); |
Joonwoo Park | 2699870 | 2012-05-09 10:10:06 -0700 | [diff] [blame] | 1210 | } else |
| 1211 | pr_debug("%s: Not using MBHC mechanical switch\n", __func__); |
| 1212 | |
| 1213 | mbhc_cfg.read_fw_bin = apq8064_hs_detect_use_firmware; |
Joonwoo Park | ca1516f | 2012-05-08 13:59:37 -0700 | [diff] [blame] | 1214 | |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 1215 | err = tabla_hs_detect(codec, &mbhc_cfg); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1216 | |
Joonwoo Park | 0332483 | 2012-03-19 19:36:16 -0700 | [diff] [blame] | 1217 | return err; |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1218 | } |
| 1219 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1220 | static int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1221 | struct snd_pcm_hw_params *params) |
| 1222 | { |
| 1223 | struct snd_interval *rate = hw_param_interval(params, |
| 1224 | SNDRV_PCM_HW_PARAM_RATE); |
| 1225 | |
| 1226 | struct snd_interval *channels = hw_param_interval(params, |
| 1227 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1228 | |
| 1229 | pr_debug("%s()\n", __func__); |
| 1230 | rate->min = rate->max = 48000; |
| 1231 | channels->min = channels->max = msm_slim_0_rx_ch; |
| 1232 | |
| 1233 | return 0; |
| 1234 | } |
| 1235 | |
| 1236 | static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1237 | struct snd_pcm_hw_params *params) |
| 1238 | { |
| 1239 | struct snd_interval *rate = hw_param_interval(params, |
| 1240 | SNDRV_PCM_HW_PARAM_RATE); |
| 1241 | |
| 1242 | struct snd_interval *channels = hw_param_interval(params, |
| 1243 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1244 | |
| 1245 | pr_debug("%s()\n", __func__); |
| 1246 | rate->min = rate->max = 48000; |
| 1247 | channels->min = channels->max = msm_slim_0_tx_ch; |
| 1248 | |
| 1249 | return 0; |
| 1250 | } |
| 1251 | |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1252 | static int msm_slim_3_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1253 | struct snd_pcm_hw_params *params) |
| 1254 | { |
| 1255 | struct snd_interval *rate = hw_param_interval(params, |
| 1256 | SNDRV_PCM_HW_PARAM_RATE); |
| 1257 | |
| 1258 | struct snd_interval *channels = hw_param_interval(params, |
| 1259 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1260 | |
| 1261 | pr_debug("%s()\n", __func__); |
| 1262 | rate->min = rate->max = 48000; |
| 1263 | channels->min = channels->max = msm_slim_3_rx_ch; |
| 1264 | |
| 1265 | return 0; |
| 1266 | } |
| 1267 | |
Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 1268 | static int msm_slim_3_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1269 | struct snd_pcm_hw_params *params) |
| 1270 | { |
| 1271 | struct snd_interval *rate = hw_param_interval(params, |
| 1272 | SNDRV_PCM_HW_PARAM_RATE); |
| 1273 | |
| 1274 | struct snd_interval *channels = hw_param_interval(params, |
| 1275 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1276 | |
| 1277 | pr_debug("%s()\n", __func__); |
| 1278 | rate->min = rate->max = 48000; |
| 1279 | channels->min = channels->max = 2; |
| 1280 | |
| 1281 | return 0; |
| 1282 | } |
| 1283 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1284 | static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1285 | struct snd_pcm_hw_params *params) |
| 1286 | { |
| 1287 | struct snd_interval *rate = hw_param_interval(params, |
| 1288 | SNDRV_PCM_HW_PARAM_RATE); |
| 1289 | |
| 1290 | pr_debug("%s()\n", __func__); |
| 1291 | rate->min = rate->max = 48000; |
| 1292 | |
| 1293 | return 0; |
| 1294 | } |
| 1295 | |
Swaminathan Sathappan | fd9dbad | 2012-02-15 16:56:44 -0800 | [diff] [blame] | 1296 | static int msm_hdmi_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1297 | struct snd_pcm_hw_params *params) |
| 1298 | { |
| 1299 | struct snd_interval *rate = hw_param_interval(params, |
| 1300 | SNDRV_PCM_HW_PARAM_RATE); |
| 1301 | |
| 1302 | struct snd_interval *channels = hw_param_interval(params, |
| 1303 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1304 | |
| 1305 | pr_debug("%s channels->min %u channels->max %u ()\n", __func__, |
| 1306 | channels->min, channels->max); |
| 1307 | |
| 1308 | rate->min = rate->max = 48000; |
| 1309 | |
| 1310 | return 0; |
| 1311 | } |
| 1312 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1313 | static int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1314 | struct snd_pcm_hw_params *params) |
| 1315 | { |
| 1316 | struct snd_interval *rate = hw_param_interval(params, |
| 1317 | SNDRV_PCM_HW_PARAM_RATE); |
| 1318 | |
| 1319 | struct snd_interval *channels = hw_param_interval(params, |
| 1320 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1321 | |
| 1322 | rate->min = rate->max = msm_btsco_rate; |
| 1323 | channels->min = channels->max = msm_btsco_ch; |
| 1324 | |
| 1325 | return 0; |
| 1326 | } |
| 1327 | static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd, |
| 1328 | struct snd_pcm_hw_params *params) |
| 1329 | { |
| 1330 | struct snd_interval *rate = hw_param_interval(params, |
| 1331 | SNDRV_PCM_HW_PARAM_RATE); |
| 1332 | |
| 1333 | struct snd_interval *channels = hw_param_interval(params, |
| 1334 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 1335 | |
| 1336 | /* PCM only supports mono output with 8khz sample rate */ |
| 1337 | rate->min = rate->max = 8000; |
| 1338 | channels->min = channels->max = 1; |
| 1339 | |
| 1340 | return 0; |
| 1341 | } |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1342 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1343 | static int msm_aux_pcm_get_gpios(void) |
| 1344 | { |
| 1345 | int ret = 0; |
| 1346 | |
| 1347 | pr_debug("%s\n", __func__); |
| 1348 | |
| 1349 | ret = gpio_request(GPIO_AUX_PCM_DOUT, "AUX PCM DOUT"); |
| 1350 | if (ret < 0) { |
| 1351 | pr_err("%s: Failed to request gpio(%d): AUX PCM DOUT", |
| 1352 | __func__, GPIO_AUX_PCM_DOUT); |
| 1353 | goto fail_dout; |
| 1354 | } |
| 1355 | |
| 1356 | ret = gpio_request(GPIO_AUX_PCM_DIN, "AUX PCM DIN"); |
| 1357 | if (ret < 0) { |
| 1358 | pr_err("%s: Failed to request gpio(%d): AUX PCM DIN", |
| 1359 | __func__, GPIO_AUX_PCM_DIN); |
| 1360 | goto fail_din; |
| 1361 | } |
| 1362 | |
| 1363 | ret = gpio_request(GPIO_AUX_PCM_SYNC, "AUX PCM SYNC"); |
| 1364 | if (ret < 0) { |
| 1365 | pr_err("%s: Failed to request gpio(%d): AUX PCM SYNC", |
| 1366 | __func__, GPIO_AUX_PCM_SYNC); |
| 1367 | goto fail_sync; |
| 1368 | } |
| 1369 | ret = gpio_request(GPIO_AUX_PCM_CLK, "AUX PCM CLK"); |
| 1370 | if (ret < 0) { |
| 1371 | pr_err("%s: Failed to request gpio(%d): AUX PCM CLK", |
| 1372 | __func__, GPIO_AUX_PCM_CLK); |
| 1373 | goto fail_clk; |
| 1374 | } |
| 1375 | |
| 1376 | return 0; |
| 1377 | |
| 1378 | fail_clk: |
| 1379 | gpio_free(GPIO_AUX_PCM_SYNC); |
| 1380 | fail_sync: |
| 1381 | gpio_free(GPIO_AUX_PCM_DIN); |
| 1382 | fail_din: |
| 1383 | gpio_free(GPIO_AUX_PCM_DOUT); |
| 1384 | fail_dout: |
| 1385 | |
| 1386 | return ret; |
| 1387 | } |
| 1388 | |
| 1389 | static int msm_aux_pcm_free_gpios(void) |
| 1390 | { |
| 1391 | gpio_free(GPIO_AUX_PCM_DIN); |
| 1392 | gpio_free(GPIO_AUX_PCM_DOUT); |
| 1393 | gpio_free(GPIO_AUX_PCM_SYNC); |
| 1394 | gpio_free(GPIO_AUX_PCM_CLK); |
| 1395 | |
| 1396 | return 0; |
| 1397 | } |
| 1398 | static int msm_startup(struct snd_pcm_substream *substream) |
| 1399 | { |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1400 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 1401 | |
| 1402 | pr_debug("%s(): dai_link_str_name = %s cpu_dai = %s codec_dai = %s\n", |
| 1403 | __func__, rtd->dai_link->stream_name, |
| 1404 | rtd->dai_link->cpu_dai_name, |
| 1405 | rtd->dai_link->codec_dai_name); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1406 | return 0; |
| 1407 | } |
| 1408 | |
| 1409 | static int msm_auxpcm_startup(struct snd_pcm_substream *substream) |
| 1410 | { |
| 1411 | int ret = 0; |
| 1412 | |
| 1413 | pr_debug("%s(): substream = %s\n", __func__, substream->name); |
| 1414 | ret = msm_aux_pcm_get_gpios(); |
| 1415 | if (ret < 0) { |
| 1416 | pr_err("%s: Aux PCM GPIO request failed\n", __func__); |
| 1417 | return -EINVAL; |
| 1418 | } |
| 1419 | return 0; |
| 1420 | } |
| 1421 | |
Neema Shetty | a58b9a2 | 2012-06-18 19:03:23 -0700 | [diff] [blame] | 1422 | static int msm_slimbus_1_startup(struct snd_pcm_substream *substream) |
| 1423 | { |
| 1424 | struct slim_controller *slim = slim_busnum_to_ctrl(1); |
| 1425 | |
| 1426 | pr_debug("%s(): substream = %s stream = %d\n", __func__, |
| 1427 | substream->name, substream->stream); |
| 1428 | |
| 1429 | if (slim != NULL) |
| 1430 | pm_runtime_get_sync(slim->dev.parent); |
| 1431 | |
| 1432 | return 0; |
| 1433 | } |
| 1434 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1435 | static void msm_auxpcm_shutdown(struct snd_pcm_substream *substream) |
| 1436 | { |
| 1437 | |
| 1438 | pr_debug("%s(): substream = %s\n", __func__, substream->name); |
| 1439 | msm_aux_pcm_free_gpios(); |
| 1440 | } |
| 1441 | |
| 1442 | static void msm_shutdown(struct snd_pcm_substream *substream) |
| 1443 | { |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1444 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 1445 | |
| 1446 | pr_debug("%s(): dai_link_str_name = %s cpu_dai = %s codec_dai = %s\n", |
| 1447 | __func__, rtd->dai_link->stream_name, |
| 1448 | rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1449 | } |
| 1450 | |
Neema Shetty | a58b9a2 | 2012-06-18 19:03:23 -0700 | [diff] [blame] | 1451 | static void msm_slimbus_1_shutdown(struct snd_pcm_substream *substream) |
| 1452 | { |
| 1453 | struct slim_controller *slim = slim_busnum_to_ctrl(1); |
| 1454 | |
| 1455 | pr_debug("%s(): substream = %s stream = %d\n", __func__, |
| 1456 | substream->name, substream->stream); |
| 1457 | |
| 1458 | if (slim != NULL) { |
| 1459 | pm_runtime_mark_last_busy(slim->dev.parent); |
| 1460 | pm_runtime_put(slim->dev.parent); |
| 1461 | } |
| 1462 | } |
| 1463 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1464 | static struct snd_soc_ops msm_be_ops = { |
| 1465 | .startup = msm_startup, |
Bharath Ramachandramurthy | 9c79f13 | 2011-11-28 11:18:57 -0800 | [diff] [blame] | 1466 | .hw_params = msm_hw_params, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1467 | .shutdown = msm_shutdown, |
| 1468 | }; |
| 1469 | |
| 1470 | static struct snd_soc_ops msm_auxpcm_be_ops = { |
| 1471 | .startup = msm_auxpcm_startup, |
| 1472 | .shutdown = msm_auxpcm_shutdown, |
| 1473 | }; |
| 1474 | |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1475 | static struct snd_soc_ops msm_slimbus_1_be_ops = { |
Neema Shetty | a58b9a2 | 2012-06-18 19:03:23 -0700 | [diff] [blame] | 1476 | .startup = msm_slimbus_1_startup, |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1477 | .hw_params = msm_slimbus_1_hw_params, |
Neema Shetty | a58b9a2 | 2012-06-18 19:03:23 -0700 | [diff] [blame] | 1478 | .shutdown = msm_slimbus_1_shutdown, |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1479 | }; |
| 1480 | |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1481 | static struct snd_soc_ops msm_slimbus_3_be_ops = { |
| 1482 | .startup = msm_startup, |
| 1483 | .hw_params = msm_slimbus_3_hw_params, |
| 1484 | .shutdown = msm_shutdown, |
| 1485 | }; |
| 1486 | |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1487 | static struct snd_soc_ops msm_slimbus_4_be_ops = { |
| 1488 | .startup = msm_startup, |
| 1489 | .hw_params = msm_slimbus_4_hw_params, |
| 1490 | .shutdown = msm_shutdown, |
| 1491 | }; |
| 1492 | |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1493 | static struct snd_soc_ops msm_slimbus_2_be_ops = { |
| 1494 | .startup = msm_startup, |
| 1495 | .hw_params = msm_slimbus_2_hw_params, |
| 1496 | .shutdown = msm_shutdown, |
| 1497 | }; |
| 1498 | |
| 1499 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1500 | /* Digital audio interface glue - connects codec <---> CPU */ |
| 1501 | static struct snd_soc_dai_link msm_dai[] = { |
| 1502 | /* FrontEnd DAI Links */ |
| 1503 | { |
| 1504 | .name = "MSM8960 Media1", |
| 1505 | .stream_name = "MultiMedia1", |
| 1506 | .cpu_dai_name = "MultiMedia1", |
| 1507 | .platform_name = "msm-pcm-dsp", |
| 1508 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1509 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
| 1510 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1511 | .codec_name = "snd-soc-dummy", |
| 1512 | .ignore_suspend = 1, |
| 1513 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1514 | .be_id = MSM_FRONTEND_DAI_MULTIMEDIA1 |
| 1515 | }, |
| 1516 | { |
| 1517 | .name = "MSM8960 Media2", |
| 1518 | .stream_name = "MultiMedia2", |
| 1519 | .cpu_dai_name = "MultiMedia2", |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1520 | .platform_name = "msm-multi-ch-pcm-dsp", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1521 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1522 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
| 1523 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1524 | .codec_name = "snd-soc-dummy", |
| 1525 | .ignore_suspend = 1, |
| 1526 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1527 | .be_id = MSM_FRONTEND_DAI_MULTIMEDIA2, |
| 1528 | }, |
| 1529 | { |
| 1530 | .name = "Circuit-Switch Voice", |
| 1531 | .stream_name = "CS-Voice", |
| 1532 | .cpu_dai_name = "CS-VOICE", |
| 1533 | .platform_name = "msm-pcm-voice", |
| 1534 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1535 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1536 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
| 1537 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1538 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1539 | .codec_name = "snd-soc-dummy", |
| 1540 | .ignore_suspend = 1, |
| 1541 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
| 1542 | .be_id = MSM_FRONTEND_DAI_CS_VOICE, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1543 | }, |
| 1544 | { |
| 1545 | .name = "MSM VoIP", |
| 1546 | .stream_name = "VoIP", |
| 1547 | .cpu_dai_name = "VoIP", |
| 1548 | .platform_name = "msm-voip-dsp", |
| 1549 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1550 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
| 1551 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1552 | .codec_name = "snd-soc-dummy", |
| 1553 | .ignore_suspend = 1, |
| 1554 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1555 | .be_id = MSM_FRONTEND_DAI_VOIP, |
| 1556 | }, |
| 1557 | { |
| 1558 | .name = "MSM8960 LPA", |
| 1559 | .stream_name = "LPA", |
| 1560 | .cpu_dai_name = "MultiMedia3", |
| 1561 | .platform_name = "msm-pcm-lpa", |
| 1562 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1563 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
| 1564 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1565 | .codec_name = "snd-soc-dummy", |
| 1566 | .ignore_suspend = 1, |
| 1567 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1568 | .be_id = MSM_FRONTEND_DAI_MULTIMEDIA3, |
| 1569 | }, |
| 1570 | /* Hostless PMC purpose */ |
| 1571 | { |
| 1572 | .name = "SLIMBUS_0 Hostless", |
| 1573 | .stream_name = "SLIMBUS_0 Hostless", |
| 1574 | .cpu_dai_name = "SLIMBUS0_HOSTLESS", |
| 1575 | .platform_name = "msm-pcm-hostless", |
| 1576 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1577 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1578 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
| 1579 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1580 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
| 1581 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1582 | .codec_name = "snd-soc-dummy", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1583 | /* .be_id = do not care */ |
| 1584 | }, |
| 1585 | { |
| 1586 | .name = "INT_FM Hostless", |
| 1587 | .stream_name = "INT_FM Hostless", |
| 1588 | .cpu_dai_name = "INT_FM_HOSTLESS", |
| 1589 | .platform_name = "msm-pcm-hostless", |
| 1590 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1591 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1592 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
| 1593 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1594 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
| 1595 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1596 | .codec_name = "snd-soc-dummy", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1597 | /* .be_id = do not care */ |
| 1598 | }, |
| 1599 | { |
| 1600 | .name = "MSM AFE-PCM RX", |
| 1601 | .stream_name = "AFE-PROXY RX", |
| 1602 | .cpu_dai_name = "msm-dai-q6.241", |
| 1603 | .codec_name = "msm-stub-codec.1", |
| 1604 | .codec_dai_name = "msm-stub-rx", |
| 1605 | .platform_name = "msm-pcm-afe", |
| 1606 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1607 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1608 | }, |
| 1609 | { |
| 1610 | .name = "MSM AFE-PCM TX", |
| 1611 | .stream_name = "AFE-PROXY TX", |
| 1612 | .cpu_dai_name = "msm-dai-q6.240", |
| 1613 | .codec_name = "msm-stub-codec.1", |
| 1614 | .codec_dai_name = "msm-stub-tx", |
| 1615 | .platform_name = "msm-pcm-afe", |
| 1616 | .ignore_suspend = 1, |
| 1617 | }, |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1618 | { |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1619 | .name = "MSM8960 Compr", |
| 1620 | .stream_name = "COMPR", |
| 1621 | .cpu_dai_name = "MultiMedia4", |
| 1622 | .platform_name = "msm-compr-dsp", |
| 1623 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1624 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
| 1625 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1626 | .codec_name = "snd-soc-dummy", |
| 1627 | .ignore_suspend = 1, |
| 1628 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1629 | .be_id = MSM_FRONTEND_DAI_MULTIMEDIA4, |
| 1630 | }, |
| 1631 | { |
| 1632 | .name = "AUXPCM Hostless", |
| 1633 | .stream_name = "AUXPCM Hostless", |
| 1634 | .cpu_dai_name = "AUXPCM_HOSTLESS", |
| 1635 | .platform_name = "msm-pcm-hostless", |
| 1636 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1637 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1638 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
| 1639 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1640 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
| 1641 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1642 | .codec_name = "snd-soc-dummy", |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1643 | }, |
| 1644 | /* HDMI Hostless */ |
| 1645 | { |
| 1646 | .name = "HDMI_RX_HOSTLESS", |
| 1647 | .stream_name = "HDMI_RX_HOSTLESS", |
| 1648 | .cpu_dai_name = "HDMI_HOSTLESS", |
| 1649 | .platform_name = "msm-pcm-hostless", |
| 1650 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1651 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1652 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1653 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1654 | .codec_name = "snd-soc-dummy", |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1655 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1656 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | f79f92b | 2012-03-29 12:11:54 -0700 | [diff] [blame] | 1657 | }, |
| 1658 | { |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1659 | .name = "Voice Stub", |
| 1660 | .stream_name = "Voice Stub", |
| 1661 | .cpu_dai_name = "VOICE_STUB", |
| 1662 | .platform_name = "msm-pcm-hostless", |
| 1663 | .dynamic = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1664 | .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1665 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
| 1666 | .ignore_suspend = 1, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1667 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
| 1668 | .codec_dai_name = "snd-soc-dummy-dai", |
| 1669 | .codec_name = "snd-soc-dummy", |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1670 | }, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1671 | /* Backend DAI Links */ |
| 1672 | { |
| 1673 | .name = LPASS_BE_SLIMBUS_0_RX, |
| 1674 | .stream_name = "Slimbus Playback", |
| 1675 | .cpu_dai_name = "msm-dai-q6.16384", |
| 1676 | .platform_name = "msm-pcm-routing", |
| 1677 | .codec_name = "tabla_codec", |
| 1678 | .codec_dai_name = "tabla_rx1", |
| 1679 | .no_pcm = 1, |
| 1680 | .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX, |
| 1681 | .init = &msm_audrx_init, |
| 1682 | .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, |
| 1683 | .ops = &msm_be_ops, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1684 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1685 | }, |
| 1686 | { |
| 1687 | .name = LPASS_BE_SLIMBUS_0_TX, |
| 1688 | .stream_name = "Slimbus Capture", |
| 1689 | .cpu_dai_name = "msm-dai-q6.16385", |
| 1690 | .platform_name = "msm-pcm-routing", |
| 1691 | .codec_name = "tabla_codec", |
| 1692 | .codec_dai_name = "tabla_tx1", |
| 1693 | .no_pcm = 1, |
| 1694 | .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX, |
| 1695 | .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, |
| 1696 | .ops = &msm_be_ops, |
| 1697 | }, |
| 1698 | /* Backend BT/FM DAI Links */ |
| 1699 | { |
| 1700 | .name = LPASS_BE_INT_BT_SCO_RX, |
| 1701 | .stream_name = "Internal BT-SCO Playback", |
| 1702 | .cpu_dai_name = "msm-dai-q6.12288", |
| 1703 | .platform_name = "msm-pcm-routing", |
| 1704 | .codec_name = "msm-stub-codec.1", |
| 1705 | .codec_dai_name = "msm-stub-rx", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1706 | .no_pcm = 1, |
| 1707 | .be_id = MSM_BACKEND_DAI_INT_BT_SCO_RX, |
| 1708 | .be_hw_params_fixup = msm_btsco_be_hw_params_fixup, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1709 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1710 | }, |
| 1711 | { |
| 1712 | .name = LPASS_BE_INT_BT_SCO_TX, |
| 1713 | .stream_name = "Internal BT-SCO Capture", |
| 1714 | .cpu_dai_name = "msm-dai-q6.12289", |
| 1715 | .platform_name = "msm-pcm-routing", |
| 1716 | .codec_name = "msm-stub-codec.1", |
| 1717 | .codec_dai_name = "msm-stub-tx", |
| 1718 | .no_pcm = 1, |
| 1719 | .be_id = MSM_BACKEND_DAI_INT_BT_SCO_TX, |
| 1720 | .be_hw_params_fixup = msm_btsco_be_hw_params_fixup, |
| 1721 | }, |
| 1722 | { |
| 1723 | .name = LPASS_BE_INT_FM_RX, |
| 1724 | .stream_name = "Internal FM Playback", |
| 1725 | .cpu_dai_name = "msm-dai-q6.12292", |
| 1726 | .platform_name = "msm-pcm-routing", |
| 1727 | .codec_name = "msm-stub-codec.1", |
| 1728 | .codec_dai_name = "msm-stub-rx", |
| 1729 | .no_pcm = 1, |
| 1730 | .be_id = MSM_BACKEND_DAI_INT_FM_RX, |
| 1731 | .be_hw_params_fixup = msm_be_hw_params_fixup, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1732 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1733 | }, |
| 1734 | { |
| 1735 | .name = LPASS_BE_INT_FM_TX, |
| 1736 | .stream_name = "Internal FM Capture", |
| 1737 | .cpu_dai_name = "msm-dai-q6.12293", |
| 1738 | .platform_name = "msm-pcm-routing", |
| 1739 | .codec_name = "msm-stub-codec.1", |
| 1740 | .codec_dai_name = "msm-stub-tx", |
| 1741 | .no_pcm = 1, |
| 1742 | .be_id = MSM_BACKEND_DAI_INT_FM_TX, |
| 1743 | .be_hw_params_fixup = msm_be_hw_params_fixup, |
| 1744 | }, |
| 1745 | /* HDMI BACK END DAI Link */ |
| 1746 | { |
| 1747 | .name = LPASS_BE_HDMI, |
| 1748 | .stream_name = "HDMI Playback", |
Swaminathan Sathappan | fd9dbad | 2012-02-15 16:56:44 -0800 | [diff] [blame] | 1749 | .cpu_dai_name = "msm-dai-q6-hdmi.8", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1750 | .platform_name = "msm-pcm-routing", |
| 1751 | .codec_name = "msm-stub-codec.1", |
| 1752 | .codec_dai_name = "msm-stub-rx", |
| 1753 | .no_pcm = 1, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1754 | .be_id = MSM_BACKEND_DAI_HDMI_RX, |
Swaminathan Sathappan | fd9dbad | 2012-02-15 16:56:44 -0800 | [diff] [blame] | 1755 | .be_hw_params_fixup = msm_hdmi_be_hw_params_fixup, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1756 | }, |
| 1757 | /* Backend AFE DAI Links */ |
| 1758 | { |
| 1759 | .name = LPASS_BE_AFE_PCM_RX, |
| 1760 | .stream_name = "AFE Playback", |
| 1761 | .cpu_dai_name = "msm-dai-q6.224", |
| 1762 | .platform_name = "msm-pcm-routing", |
| 1763 | .codec_name = "msm-stub-codec.1", |
| 1764 | .codec_dai_name = "msm-stub-rx", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1765 | .no_pcm = 1, |
| 1766 | .be_id = MSM_BACKEND_DAI_AFE_PCM_RX, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1767 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1768 | }, |
| 1769 | { |
| 1770 | .name = LPASS_BE_AFE_PCM_TX, |
| 1771 | .stream_name = "AFE Capture", |
| 1772 | .cpu_dai_name = "msm-dai-q6.225", |
| 1773 | .platform_name = "msm-pcm-routing", |
| 1774 | .codec_name = "msm-stub-codec.1", |
| 1775 | .codec_dai_name = "msm-stub-tx", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1776 | .no_pcm = 1, |
| 1777 | .be_id = MSM_BACKEND_DAI_AFE_PCM_TX, |
| 1778 | }, |
| 1779 | /* AUX PCM Backend DAI Links */ |
| 1780 | { |
| 1781 | .name = LPASS_BE_AUXPCM_RX, |
| 1782 | .stream_name = "AUX PCM Playback", |
| 1783 | .cpu_dai_name = "msm-dai-q6.2", |
| 1784 | .platform_name = "msm-pcm-routing", |
| 1785 | .codec_name = "msm-stub-codec.1", |
| 1786 | .codec_dai_name = "msm-stub-rx", |
| 1787 | .no_pcm = 1, |
| 1788 | .be_id = MSM_BACKEND_DAI_AUXPCM_RX, |
| 1789 | .be_hw_params_fixup = msm_auxpcm_be_params_fixup, |
| 1790 | .ops = &msm_auxpcm_be_ops, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1791 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1792 | }, |
| 1793 | { |
| 1794 | .name = LPASS_BE_AUXPCM_TX, |
| 1795 | .stream_name = "AUX PCM Capture", |
| 1796 | .cpu_dai_name = "msm-dai-q6.3", |
| 1797 | .platform_name = "msm-pcm-routing", |
| 1798 | .codec_name = "msm-stub-codec.1", |
| 1799 | .codec_dai_name = "msm-stub-tx", |
| 1800 | .no_pcm = 1, |
| 1801 | .be_id = MSM_BACKEND_DAI_AUXPCM_TX, |
| 1802 | .be_hw_params_fixup = msm_auxpcm_be_params_fixup, |
| 1803 | }, |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1804 | { |
| 1805 | .name = LPASS_BE_STUB_RX, |
| 1806 | .stream_name = "Stub Playback", |
| 1807 | .cpu_dai_name = "msm-dai-stub", |
| 1808 | .platform_name = "msm-pcm-routing", |
| 1809 | .codec_name = "tabla_codec", |
| 1810 | .codec_dai_name = "tabla_rx2", |
| 1811 | .no_pcm = 1, |
Neema Shetty | e5cae8e | 2012-04-27 18:07:37 -0700 | [diff] [blame] | 1812 | .be_id = MSM_BACKEND_DAI_EXTPROC_RX, |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1813 | .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, |
Helen Zeng | f3b17fb | 2012-02-28 15:07:38 -0800 | [diff] [blame] | 1814 | .init = &msm_stubrx_init, |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1815 | .ops = &msm_be_ops, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1816 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1817 | }, |
| 1818 | { |
| 1819 | .name = LPASS_BE_STUB_TX, |
| 1820 | .stream_name = "Stub Capture", |
| 1821 | .cpu_dai_name = "msm-dai-stub", |
| 1822 | .platform_name = "msm-pcm-routing", |
| 1823 | .codec_name = "tabla_codec", |
| 1824 | .codec_dai_name = "tabla_tx1", |
| 1825 | .no_pcm = 1, |
Neema Shetty | e5cae8e | 2012-04-27 18:07:37 -0700 | [diff] [blame] | 1826 | .be_id = MSM_BACKEND_DAI_EXTPROC_TX, |
Neema Shetty | b945124 | 2012-02-16 15:37:59 -0800 | [diff] [blame] | 1827 | .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, |
| 1828 | .ops = &msm_be_ops, |
| 1829 | }, |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1830 | { |
| 1831 | .name = LPASS_BE_SLIMBUS_1_RX, |
| 1832 | .stream_name = "Slimbus1 Playback", |
| 1833 | .cpu_dai_name = "msm-dai-q6.16386", |
| 1834 | .platform_name = "msm-pcm-routing", |
| 1835 | .codec_name = "msm-stub-codec.1", |
| 1836 | .codec_dai_name = "msm-stub-rx", |
| 1837 | .no_pcm = 1, |
| 1838 | .be_id = MSM_BACKEND_DAI_SLIMBUS_1_RX, |
| 1839 | .be_hw_params_fixup = msm_btsco_be_hw_params_fixup, |
| 1840 | .ops = &msm_slimbus_1_be_ops, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1841 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 1842 | |
| 1843 | }, |
| 1844 | { |
| 1845 | .name = LPASS_BE_SLIMBUS_1_TX, |
| 1846 | .stream_name = "Slimbus1 Capture", |
| 1847 | .cpu_dai_name = "msm-dai-q6.16387", |
| 1848 | .platform_name = "msm-pcm-routing", |
| 1849 | .codec_name = "msm-stub-codec.1", |
| 1850 | .codec_dai_name = "msm-stub-tx", |
| 1851 | .no_pcm = 1, |
| 1852 | .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, |
| 1853 | .be_hw_params_fixup = msm_btsco_be_hw_params_fixup, |
| 1854 | .ops = &msm_slimbus_1_be_ops, |
| 1855 | }, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1856 | /* Ultrasound TX Back End DAI Link */ |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 1857 | { |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1858 | .name = "SLIMBUS_2 Hostless Capture", |
| 1859 | .stream_name = "SLIMBUS_2 Hostless Capture", |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 1860 | .cpu_dai_name = "msm-dai-q6.16389", |
| 1861 | .platform_name = "msm-pcm-hostless", |
| 1862 | .codec_name = "tabla_codec", |
| 1863 | .codec_dai_name = "tabla_tx2", |
Swaminathan Sathappan | 630c5a4 | 2012-05-10 17:33:01 -0700 | [diff] [blame] | 1864 | .ignore_suspend = 1, |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 1865 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1866 | .ops = &msm_slimbus_2_be_ops, |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 1867 | }, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 1868 | /* Ultrasound RX Back End DAI Link */ |
| 1869 | { |
| 1870 | .name = "SLIMBUS_2 Hostless Playback", |
| 1871 | .stream_name = "SLIMBUS_2 Hostless Playback", |
| 1872 | .cpu_dai_name = "msm-dai-q6.16388", |
| 1873 | .platform_name = "msm-pcm-hostless", |
| 1874 | .codec_name = "tabla_codec", |
| 1875 | .codec_dai_name = "tabla_rx3", |
| 1876 | .ignore_suspend = 1, |
| 1877 | .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, |
| 1878 | .ops = &msm_slimbus_2_be_ops, |
| 1879 | }, |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1880 | /* Incall Music Back End DAI Link */ |
| 1881 | { |
| 1882 | .name = LPASS_BE_SLIMBUS_4_RX, |
| 1883 | .stream_name = "Slimbus4 Playback", |
| 1884 | .cpu_dai_name = "msm-dai-q6.16392", |
| 1885 | .platform_name = "msm-pcm-routing", |
| 1886 | .codec_name = "msm-stub-codec.1", |
| 1887 | .codec_dai_name = "msm-stub-rx", |
| 1888 | .no_pcm = 1, |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1889 | .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX, |
| 1890 | .be_hw_params_fixup = msm_be_hw_params_fixup, |
| 1891 | .ops = &msm_slimbus_4_be_ops, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1892 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1893 | }, |
| 1894 | /* Incall Record Back End DAI Link */ |
| 1895 | { |
| 1896 | .name = LPASS_BE_SLIMBUS_4_TX, |
| 1897 | .stream_name = "Slimbus4 Capture", |
| 1898 | .cpu_dai_name = "msm-dai-q6.16393", |
| 1899 | .platform_name = "msm-pcm-routing", |
| 1900 | .codec_name = "msm-stub-codec.1", |
| 1901 | .codec_dai_name = "msm-stub-tx", |
| 1902 | .no_pcm = 1, |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1903 | .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX, |
| 1904 | .be_hw_params_fixup = msm_be_hw_params_fixup, |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 1905 | .ops = &msm_slimbus_4_be_ops, |
| 1906 | }, |
Neema Shetty | e5cae8e | 2012-04-27 18:07:37 -0700 | [diff] [blame] | 1907 | { |
| 1908 | .name = LPASS_BE_STUB_1_TX, |
| 1909 | .stream_name = "Stub1 Capture", |
| 1910 | .cpu_dai_name = "msm-dai-stub", |
| 1911 | .platform_name = "msm-pcm-routing", |
| 1912 | .codec_name = "tabla_codec", |
| 1913 | .codec_dai_name = "tabla_tx3", |
| 1914 | .no_pcm = 1, |
| 1915 | .be_id = MSM_BACKEND_DAI_EXTPROC_EC_TX, |
| 1916 | /* This BE is used for external EC reference from codec. Since |
| 1917 | * Rx is fed as reference for EC, the config of this DAI is |
| 1918 | * based on that of the Rx path. |
| 1919 | */ |
| 1920 | .be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup, |
| 1921 | .ops = &msm_be_ops, |
| 1922 | }, |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1923 | { |
| 1924 | |
| 1925 | .name = LPASS_BE_SLIMBUS_3_RX, |
| 1926 | .stream_name = "Slimbus3 Playback", |
| 1927 | .cpu_dai_name = "msm-dai-q6.16390", |
| 1928 | .platform_name = "msm-pcm-routing", |
| 1929 | .codec_name = "msm-stub-codec.1", |
| 1930 | .codec_dai_name = "msm-stub-rx", |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1931 | .no_pcm = 1, |
| 1932 | .be_id = MSM_BACKEND_DAI_SLIMBUS_3_RX, |
| 1933 | .be_hw_params_fixup = msm_slim_3_rx_be_hw_params_fixup, |
| 1934 | .ops = &msm_slimbus_3_be_ops, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1935 | .ignore_pmdown_time = 1, /* this dainlink has playback support */ |
Neema Shetty | 74131ac | 2012-05-09 13:35:26 -0700 | [diff] [blame] | 1936 | }, |
Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 1937 | { |
| 1938 | .name = LPASS_BE_SLIMBUS_3_TX, |
| 1939 | .stream_name = "Slimbus3 Capture", |
| 1940 | .cpu_dai_name = "msm-dai-q6.16391", |
| 1941 | .platform_name = "msm-pcm-routing", |
| 1942 | .codec_name = "msm-stub-codec.1", |
| 1943 | .codec_dai_name = "msm-stub-tx", |
| 1944 | .no_pcm = 1, |
| 1945 | .be_id = MSM_BACKEND_DAI_SLIMBUS_3_TX, |
| 1946 | .be_hw_params_fixup = msm_slim_3_tx_be_hw_params_fixup, |
| 1947 | .ops = &msm_slimbus_3_be_ops, |
| 1948 | }, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1949 | }; |
| 1950 | |
| 1951 | struct snd_soc_card snd_soc_card_msm = { |
Swaminathan Sathappan | c165a3a | 2012-02-29 12:44:31 -0800 | [diff] [blame] | 1952 | .name = "apq8064-tabla-snd-card", |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1953 | .dai_link = msm_dai, |
| 1954 | .num_links = ARRAY_SIZE(msm_dai), |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 1955 | .controls = tabla_msm_controls, |
| 1956 | .num_controls = ARRAY_SIZE(tabla_msm_controls), |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1957 | }; |
| 1958 | |
| 1959 | static struct platform_device *msm_snd_device; |
| 1960 | |
| 1961 | static int msm_configure_headset_mic_gpios(void) |
| 1962 | { |
| 1963 | int ret; |
| 1964 | struct pm_gpio param = { |
| 1965 | .direction = PM_GPIO_DIR_OUT, |
| 1966 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 1967 | .output_value = 1, |
| 1968 | .pull = PM_GPIO_PULL_NO, |
| 1969 | .vin_sel = PM_GPIO_VIN_S4, |
| 1970 | .out_strength = PM_GPIO_STRENGTH_MED, |
| 1971 | .function = PM_GPIO_FUNC_NORMAL, |
| 1972 | }; |
| 1973 | |
| 1974 | ret = gpio_request(PM8921_GPIO_PM_TO_SYS(23), "AV_SWITCH"); |
| 1975 | if (ret) { |
| 1976 | pr_err("%s: Failed to request gpio %d\n", __func__, |
| 1977 | PM8921_GPIO_PM_TO_SYS(23)); |
| 1978 | return ret; |
| 1979 | } |
| 1980 | |
| 1981 | ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(23), ¶m); |
| 1982 | if (ret) |
| 1983 | pr_err("%s: Failed to configure gpio %d\n", __func__, |
| 1984 | PM8921_GPIO_PM_TO_SYS(23)); |
| 1985 | else |
| 1986 | gpio_direction_output(PM8921_GPIO_PM_TO_SYS(23), 0); |
| 1987 | |
| 1988 | ret = gpio_request(PM8921_GPIO_PM_TO_SYS(35), "US_EURO_SWITCH"); |
| 1989 | if (ret) { |
| 1990 | pr_err("%s: Failed to request gpio %d\n", __func__, |
| 1991 | PM8921_GPIO_PM_TO_SYS(35)); |
| 1992 | gpio_free(PM8921_GPIO_PM_TO_SYS(23)); |
| 1993 | return ret; |
| 1994 | } |
| 1995 | ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(35), ¶m); |
| 1996 | if (ret) |
| 1997 | pr_err("%s: Failed to configure gpio %d\n", __func__, |
| 1998 | PM8921_GPIO_PM_TO_SYS(35)); |
| 1999 | else |
| 2000 | gpio_direction_output(PM8921_GPIO_PM_TO_SYS(35), 0); |
| 2001 | |
| 2002 | return 0; |
| 2003 | } |
| 2004 | static void msm_free_headset_mic_gpios(void) |
| 2005 | { |
| 2006 | if (msm_headset_gpios_configured) { |
| 2007 | gpio_free(PM8921_GPIO_PM_TO_SYS(23)); |
| 2008 | gpio_free(PM8921_GPIO_PM_TO_SYS(35)); |
| 2009 | } |
| 2010 | } |
| 2011 | |
| 2012 | static int __init msm_audio_init(void) |
| 2013 | { |
| 2014 | int ret; |
| 2015 | |
Santosh Mardi | 911b27fd | 2012-04-04 03:09:01 +0530 | [diff] [blame] | 2016 | if (!cpu_is_apq8064() || (socinfo_get_id() == 130)) { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2017 | pr_err("%s: Not the right machine type\n", __func__); |
| 2018 | return -ENODEV; |
| 2019 | } |
| 2020 | |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 2021 | mbhc_cfg.calibration = def_tabla_mbhc_cal(); |
| 2022 | if (!mbhc_cfg.calibration) { |
Joonwoo Park | 0976d01 | 2011-12-22 11:48:18 -0800 | [diff] [blame] | 2023 | pr_err("Calibration data allocation failed\n"); |
| 2024 | return -ENOMEM; |
| 2025 | } |
| 2026 | |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2027 | msm_snd_device = platform_device_alloc("soc-audio", 0); |
| 2028 | if (!msm_snd_device) { |
| 2029 | pr_err("Platform device allocation failed\n"); |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 2030 | kfree(mbhc_cfg.calibration); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2031 | return -ENOMEM; |
| 2032 | } |
| 2033 | |
| 2034 | platform_set_drvdata(msm_snd_device, &snd_soc_card_msm); |
| 2035 | ret = platform_device_add(msm_snd_device); |
| 2036 | if (ret) { |
| 2037 | platform_device_put(msm_snd_device); |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 2038 | kfree(mbhc_cfg.calibration); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2039 | return ret; |
| 2040 | } |
| 2041 | |
| 2042 | if (msm_configure_headset_mic_gpios()) { |
| 2043 | pr_err("%s Fail to configure headset mic gpios\n", __func__); |
| 2044 | msm_headset_gpios_configured = 0; |
| 2045 | } else |
| 2046 | msm_headset_gpios_configured = 1; |
| 2047 | |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 2048 | mutex_init(&cdc_mclk_mutex); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2049 | return ret; |
| 2050 | |
| 2051 | } |
| 2052 | module_init(msm_audio_init); |
| 2053 | |
| 2054 | static void __exit msm_audio_exit(void) |
| 2055 | { |
Santosh Mardi | 911b27fd | 2012-04-04 03:09:01 +0530 | [diff] [blame] | 2056 | if (!cpu_is_apq8064() || (socinfo_get_id() == 130)) { |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2057 | pr_err("%s: Not the right machine type\n", __func__); |
| 2058 | return ; |
| 2059 | } |
| 2060 | msm_free_headset_mic_gpios(); |
| 2061 | platform_device_unregister(msm_snd_device); |
Joonwoo Park | ca1516f | 2012-05-08 13:59:37 -0700 | [diff] [blame] | 2062 | if (mbhc_cfg.gpio) |
| 2063 | gpio_free(mbhc_cfg.gpio); |
Joonwoo Park | d7cf2e9 | 2012-03-19 19:38:23 -0700 | [diff] [blame] | 2064 | kfree(mbhc_cfg.calibration); |
Joonwoo Park | 9db5fb7a | 2012-06-15 12:10:46 -0700 | [diff] [blame] | 2065 | mutex_destroy(&cdc_mclk_mutex); |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2066 | } |
| 2067 | module_exit(msm_audio_exit); |
| 2068 | |
| 2069 | MODULE_DESCRIPTION("ALSA SoC msm"); |
| 2070 | MODULE_LICENSE("GPL v2"); |