1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. 3 // Copyright (c) 2018, Linaro Limited 4 5 #include <dt-bindings/sound/qcom,q6asm.h> 6 #include <dt-bindings/sound/qcom,q6afe.h> 7 #include <linux/init.h> 8 #include <linux/err.h> 9 #include <linux/module.h> 10 #include <linux/of.h> 11 #include <linux/platform_device.h> 12 #include <linux/bitops.h> 13 #include <linux/mutex.h> 14 #include <linux/slab.h> 15 #include <sound/core.h> 16 #include <sound/soc.h> 17 #include <sound/soc-dapm.h> 18 #include <sound/pcm.h> 19 #include <sound/control.h> 20 #include <sound/asound.h> 21 #include <sound/pcm_params.h> 22 #include "q6afe.h" 23 #include "q6asm.h" 24 #include "q6adm.h" 25 #include "q6routing.h" 26 27 #define DRV_NAME "q6routing-component" 28 29 #define Q6ROUTING_RX_MIXERS(id) \ 30 SOC_SINGLE_EXT("MultiMedia1", id, \ 31 MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,\ 32 msm_routing_put_audio_mixer), \ 33 SOC_SINGLE_EXT("MultiMedia2", id, \ 34 MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,\ 35 msm_routing_put_audio_mixer), \ 36 SOC_SINGLE_EXT("MultiMedia3", id, \ 37 MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,\ 38 msm_routing_put_audio_mixer), \ 39 SOC_SINGLE_EXT("MultiMedia4", id, \ 40 MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,\ 41 msm_routing_put_audio_mixer), \ 42 SOC_SINGLE_EXT("MultiMedia5", id, \ 43 MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,\ 44 msm_routing_put_audio_mixer), \ 45 SOC_SINGLE_EXT("MultiMedia6", id, \ 46 MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,\ 47 msm_routing_put_audio_mixer), \ 48 SOC_SINGLE_EXT("MultiMedia7", id, \ 49 MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,\ 50 msm_routing_put_audio_mixer), \ 51 SOC_SINGLE_EXT("MultiMedia8", id, \ 52 MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,\ 53 msm_routing_put_audio_mixer), 54 55 #define Q6ROUTING_RX_DAPM_ROUTE(mix_name, s) \ 56 { mix_name, "MultiMedia1", "MM_DL1" }, \ 57 { mix_name, "MultiMedia2", "MM_DL2" }, \ 58 { mix_name, "MultiMedia3", "MM_DL3" }, \ 59 { mix_name, "MultiMedia4", "MM_DL4" }, \ 60 { mix_name, "MultiMedia5", "MM_DL5" }, \ 61 { mix_name, "MultiMedia6", "MM_DL6" }, \ 62 { mix_name, "MultiMedia7", "MM_DL7" }, \ 63 { mix_name, "MultiMedia8", "MM_DL8" }, \ 64 { s, NULL, mix_name } 65 66 #define Q6ROUTING_TX_DAPM_ROUTE(mix_name) \ 67 { mix_name, "PRI_MI2S_TX", "PRI_MI2S_TX" }, \ 68 { mix_name, "SEC_MI2S_TX", "SEC_MI2S_TX" }, \ 69 { mix_name, "QUAT_MI2S_TX", "QUAT_MI2S_TX" }, \ 70 { mix_name, "QUIN_MI2S_TX", "QUIN_MI2S_TX" }, \ 71 { mix_name, "TERT_MI2S_TX", "TERT_MI2S_TX" }, \ 72 { mix_name, "SLIMBUS_0_TX", "SLIMBUS_0_TX" }, \ 73 { mix_name, "SLIMBUS_1_TX", "SLIMBUS_1_TX" }, \ 74 { mix_name, "SLIMBUS_2_TX", "SLIMBUS_2_TX" }, \ 75 { mix_name, "SLIMBUS_3_TX", "SLIMBUS_3_TX" }, \ 76 { mix_name, "SLIMBUS_4_TX", "SLIMBUS_4_TX" }, \ 77 { mix_name, "SLIMBUS_5_TX", "SLIMBUS_5_TX" }, \ 78 { mix_name, "SLIMBUS_6_TX", "SLIMBUS_6_TX" }, \ 79 { mix_name, "PRIMARY_TDM_TX_0", "PRIMARY_TDM_TX_0"}, \ 80 { mix_name, "PRIMARY_TDM_TX_1", "PRIMARY_TDM_TX_1"}, \ 81 { mix_name, "PRIMARY_TDM_TX_2", "PRIMARY_TDM_TX_2"}, \ 82 { mix_name, "PRIMARY_TDM_TX_3", "PRIMARY_TDM_TX_3"}, \ 83 { mix_name, "PRIMARY_TDM_TX_4", "PRIMARY_TDM_TX_4"}, \ 84 { mix_name, "PRIMARY_TDM_TX_5", "PRIMARY_TDM_TX_5"}, \ 85 { mix_name, "PRIMARY_TDM_TX_6", "PRIMARY_TDM_TX_6"}, \ 86 { mix_name, "PRIMARY_TDM_TX_7", "PRIMARY_TDM_TX_7"}, \ 87 { mix_name, "SEC_TDM_TX_0", "SEC_TDM_TX_0"}, \ 88 { mix_name, "SEC_TDM_TX_1", "SEC_TDM_TX_1"}, \ 89 { mix_name, "SEC_TDM_TX_2", "SEC_TDM_TX_2"}, \ 90 { mix_name, "SEC_TDM_TX_3", "SEC_TDM_TX_3"}, \ 91 { mix_name, "SEC_TDM_TX_4", "SEC_TDM_TX_4"}, \ 92 { mix_name, "SEC_TDM_TX_5", "SEC_TDM_TX_5"}, \ 93 { mix_name, "SEC_TDM_TX_6", "SEC_TDM_TX_6"}, \ 94 { mix_name, "SEC_TDM_TX_7", "SEC_TDM_TX_7"}, \ 95 { mix_name, "TERT_TDM_TX_0", "TERT_TDM_TX_0"}, \ 96 { mix_name, "TERT_TDM_TX_1", "TERT_TDM_TX_1"}, \ 97 { mix_name, "TERT_TDM_TX_2", "TERT_TDM_TX_2"}, \ 98 { mix_name, "TERT_TDM_TX_3", "TERT_TDM_TX_3"}, \ 99 { mix_name, "TERT_TDM_TX_4", "TERT_TDM_TX_4"}, \ 100 { mix_name, "TERT_TDM_TX_5", "TERT_TDM_TX_5"}, \ 101 { mix_name, "TERT_TDM_TX_6", "TERT_TDM_TX_6"}, \ 102 { mix_name, "TERT_TDM_TX_7", "TERT_TDM_TX_7"}, \ 103 { mix_name, "QUAT_TDM_TX_0", "QUAT_TDM_TX_0"}, \ 104 { mix_name, "QUAT_TDM_TX_1", "QUAT_TDM_TX_1"}, \ 105 { mix_name, "QUAT_TDM_TX_2", "QUAT_TDM_TX_2"}, \ 106 { mix_name, "QUAT_TDM_TX_3", "QUAT_TDM_TX_3"}, \ 107 { mix_name, "QUAT_TDM_TX_4", "QUAT_TDM_TX_4"}, \ 108 { mix_name, "QUAT_TDM_TX_5", "QUAT_TDM_TX_5"}, \ 109 { mix_name, "QUAT_TDM_TX_6", "QUAT_TDM_TX_6"}, \ 110 { mix_name, "QUAT_TDM_TX_7", "QUAT_TDM_TX_7"}, \ 111 { mix_name, "QUIN_TDM_TX_0", "QUIN_TDM_TX_0"}, \ 112 { mix_name, "QUIN_TDM_TX_1", "QUIN_TDM_TX_1"}, \ 113 { mix_name, "QUIN_TDM_TX_2", "QUIN_TDM_TX_2"}, \ 114 { mix_name, "QUIN_TDM_TX_3", "QUIN_TDM_TX_3"}, \ 115 { mix_name, "QUIN_TDM_TX_4", "QUIN_TDM_TX_4"}, \ 116 { mix_name, "QUIN_TDM_TX_5", "QUIN_TDM_TX_5"}, \ 117 { mix_name, "QUIN_TDM_TX_6", "QUIN_TDM_TX_6"}, \ 118 { mix_name, "QUIN_TDM_TX_7", "QUIN_TDM_TX_7"}, \ 119 { mix_name, "WSA_CODEC_DMA_TX_0", "WSA_CODEC_DMA_TX_0"}, \ 120 { mix_name, "WSA_CODEC_DMA_TX_1", "WSA_CODEC_DMA_TX_1"}, \ 121 { mix_name, "WSA_CODEC_DMA_TX_2", "WSA_CODEC_DMA_TX_2"}, \ 122 { mix_name, "VA_CODEC_DMA_TX_0", "VA_CODEC_DMA_TX_0"}, \ 123 { mix_name, "VA_CODEC_DMA_TX_1", "VA_CODEC_DMA_TX_1"}, \ 124 { mix_name, "VA_CODEC_DMA_TX_2", "VA_CODEC_DMA_TX_2"}, \ 125 { mix_name, "TX_CODEC_DMA_TX_0", "TX_CODEC_DMA_TX_0"}, \ 126 { mix_name, "TX_CODEC_DMA_TX_1", "TX_CODEC_DMA_TX_1"}, \ 127 { mix_name, "TX_CODEC_DMA_TX_2", "TX_CODEC_DMA_TX_2"}, \ 128 { mix_name, "TX_CODEC_DMA_TX_3", "TX_CODEC_DMA_TX_3"}, \ 129 { mix_name, "TX_CODEC_DMA_TX_4", "TX_CODEC_DMA_TX_4"}, \ 130 { mix_name, "TX_CODEC_DMA_TX_5", "TX_CODEC_DMA_TX_5"} 131 132 #define Q6ROUTING_TX_MIXERS(id) \ 133 SOC_SINGLE_EXT("PRI_MI2S_TX", PRIMARY_MI2S_TX, \ 134 id, 1, 0, msm_routing_get_audio_mixer, \ 135 msm_routing_put_audio_mixer), \ 136 SOC_SINGLE_EXT("SEC_MI2S_TX", SECONDARY_MI2S_TX, \ 137 id, 1, 0, msm_routing_get_audio_mixer, \ 138 msm_routing_put_audio_mixer), \ 139 SOC_SINGLE_EXT("TERT_MI2S_TX", TERTIARY_MI2S_TX, \ 140 id, 1, 0, msm_routing_get_audio_mixer, \ 141 msm_routing_put_audio_mixer), \ 142 SOC_SINGLE_EXT("QUAT_MI2S_TX", QUATERNARY_MI2S_TX, \ 143 id, 1, 0, msm_routing_get_audio_mixer, \ 144 msm_routing_put_audio_mixer), \ 145 SOC_SINGLE_EXT("QUIN_MI2S_TX", QUINARY_MI2S_TX, \ 146 id, 1, 0, msm_routing_get_audio_mixer, \ 147 msm_routing_put_audio_mixer), \ 148 SOC_SINGLE_EXT("SLIMBUS_0_TX", SLIMBUS_0_TX, \ 149 id, 1, 0, msm_routing_get_audio_mixer, \ 150 msm_routing_put_audio_mixer), \ 151 SOC_SINGLE_EXT("SLIMBUS_1_TX", SLIMBUS_1_TX, \ 152 id, 1, 0, msm_routing_get_audio_mixer, \ 153 msm_routing_put_audio_mixer), \ 154 SOC_SINGLE_EXT("SLIMBUS_2_TX", SLIMBUS_2_TX, \ 155 id, 1, 0, msm_routing_get_audio_mixer, \ 156 msm_routing_put_audio_mixer), \ 157 SOC_SINGLE_EXT("SLIMBUS_3_TX", SLIMBUS_3_TX, \ 158 id, 1, 0, msm_routing_get_audio_mixer, \ 159 msm_routing_put_audio_mixer), \ 160 SOC_SINGLE_EXT("SLIMBUS_4_TX", SLIMBUS_4_TX, \ 161 id, 1, 0, msm_routing_get_audio_mixer, \ 162 msm_routing_put_audio_mixer), \ 163 SOC_SINGLE_EXT("SLIMBUS_5_TX", SLIMBUS_5_TX, \ 164 id, 1, 0, msm_routing_get_audio_mixer, \ 165 msm_routing_put_audio_mixer), \ 166 SOC_SINGLE_EXT("SLIMBUS_6_TX", SLIMBUS_6_TX, \ 167 id, 1, 0, msm_routing_get_audio_mixer, \ 168 msm_routing_put_audio_mixer), \ 169 SOC_SINGLE_EXT("PRIMARY_TDM_TX_0", PRIMARY_TDM_TX_0, \ 170 id, 1, 0, msm_routing_get_audio_mixer, \ 171 msm_routing_put_audio_mixer), \ 172 SOC_SINGLE_EXT("PRIMARY_TDM_TX_1", PRIMARY_TDM_TX_1, \ 173 id, 1, 0, msm_routing_get_audio_mixer, \ 174 msm_routing_put_audio_mixer), \ 175 SOC_SINGLE_EXT("PRIMARY_TDM_TX_2", PRIMARY_TDM_TX_2, \ 176 id, 1, 0, msm_routing_get_audio_mixer, \ 177 msm_routing_put_audio_mixer), \ 178 SOC_SINGLE_EXT("PRIMARY_TDM_TX_3", PRIMARY_TDM_TX_3, \ 179 id, 1, 0, msm_routing_get_audio_mixer, \ 180 msm_routing_put_audio_mixer), \ 181 SOC_SINGLE_EXT("PRIMARY_TDM_TX_4", PRIMARY_TDM_TX_4, \ 182 id, 1, 0, msm_routing_get_audio_mixer, \ 183 msm_routing_put_audio_mixer), \ 184 SOC_SINGLE_EXT("PRIMARY_TDM_TX_5", PRIMARY_TDM_TX_5, \ 185 id, 1, 0, msm_routing_get_audio_mixer, \ 186 msm_routing_put_audio_mixer), \ 187 SOC_SINGLE_EXT("PRIMARY_TDM_TX_6", PRIMARY_TDM_TX_6, \ 188 id, 1, 0, msm_routing_get_audio_mixer, \ 189 msm_routing_put_audio_mixer), \ 190 SOC_SINGLE_EXT("PRIMARY_TDM_TX_7", PRIMARY_TDM_TX_7, \ 191 id, 1, 0, msm_routing_get_audio_mixer, \ 192 msm_routing_put_audio_mixer), \ 193 SOC_SINGLE_EXT("SEC_TDM_TX_0", SECONDARY_TDM_TX_0, \ 194 id, 1, 0, msm_routing_get_audio_mixer, \ 195 msm_routing_put_audio_mixer), \ 196 SOC_SINGLE_EXT("SEC_TDM_TX_1", SECONDARY_TDM_TX_1, \ 197 id, 1, 0, msm_routing_get_audio_mixer, \ 198 msm_routing_put_audio_mixer), \ 199 SOC_SINGLE_EXT("SEC_TDM_TX_2", SECONDARY_TDM_TX_2, \ 200 id, 1, 0, msm_routing_get_audio_mixer, \ 201 msm_routing_put_audio_mixer), \ 202 SOC_SINGLE_EXT("SEC_TDM_TX_3", SECONDARY_TDM_TX_3, \ 203 id, 1, 0, msm_routing_get_audio_mixer, \ 204 msm_routing_put_audio_mixer), \ 205 SOC_SINGLE_EXT("SEC_TDM_TX_4", SECONDARY_TDM_TX_4, \ 206 id, 1, 0, msm_routing_get_audio_mixer, \ 207 msm_routing_put_audio_mixer), \ 208 SOC_SINGLE_EXT("SEC_TDM_TX_5", SECONDARY_TDM_TX_5, \ 209 id, 1, 0, msm_routing_get_audio_mixer, \ 210 msm_routing_put_audio_mixer), \ 211 SOC_SINGLE_EXT("SEC_TDM_TX_6", SECONDARY_TDM_TX_6, \ 212 id, 1, 0, msm_routing_get_audio_mixer, \ 213 msm_routing_put_audio_mixer), \ 214 SOC_SINGLE_EXT("SEC_TDM_TX_7", SECONDARY_TDM_TX_7, \ 215 id, 1, 0, msm_routing_get_audio_mixer, \ 216 msm_routing_put_audio_mixer), \ 217 SOC_SINGLE_EXT("TERT_TDM_TX_0", TERTIARY_TDM_TX_0, \ 218 id, 1, 0, msm_routing_get_audio_mixer, \ 219 msm_routing_put_audio_mixer), \ 220 SOC_SINGLE_EXT("TERT_TDM_TX_1", TERTIARY_TDM_TX_1, \ 221 id, 1, 0, msm_routing_get_audio_mixer, \ 222 msm_routing_put_audio_mixer), \ 223 SOC_SINGLE_EXT("TERT_TDM_TX_2", TERTIARY_TDM_TX_2, \ 224 id, 1, 0, msm_routing_get_audio_mixer, \ 225 msm_routing_put_audio_mixer), \ 226 SOC_SINGLE_EXT("TERT_TDM_TX_3", TERTIARY_TDM_TX_3, \ 227 id, 1, 0, msm_routing_get_audio_mixer, \ 228 msm_routing_put_audio_mixer), \ 229 SOC_SINGLE_EXT("TERT_TDM_TX_4", TERTIARY_TDM_TX_4, \ 230 id, 1, 0, msm_routing_get_audio_mixer, \ 231 msm_routing_put_audio_mixer), \ 232 SOC_SINGLE_EXT("TERT_TDM_TX_5", TERTIARY_TDM_TX_5, \ 233 id, 1, 0, msm_routing_get_audio_mixer, \ 234 msm_routing_put_audio_mixer), \ 235 SOC_SINGLE_EXT("TERT_TDM_TX_6", TERTIARY_TDM_TX_6, \ 236 id, 1, 0, msm_routing_get_audio_mixer, \ 237 msm_routing_put_audio_mixer), \ 238 SOC_SINGLE_EXT("TERT_TDM_TX_7", TERTIARY_TDM_TX_7, \ 239 id, 1, 0, msm_routing_get_audio_mixer, \ 240 msm_routing_put_audio_mixer), \ 241 SOC_SINGLE_EXT("QUAT_TDM_TX_0", QUATERNARY_TDM_TX_0, \ 242 id, 1, 0, msm_routing_get_audio_mixer, \ 243 msm_routing_put_audio_mixer), \ 244 SOC_SINGLE_EXT("QUAT_TDM_TX_1", QUATERNARY_TDM_TX_1, \ 245 id, 1, 0, msm_routing_get_audio_mixer, \ 246 msm_routing_put_audio_mixer), \ 247 SOC_SINGLE_EXT("QUAT_TDM_TX_2", QUATERNARY_TDM_TX_2, \ 248 id, 1, 0, msm_routing_get_audio_mixer, \ 249 msm_routing_put_audio_mixer), \ 250 SOC_SINGLE_EXT("QUAT_TDM_TX_3", QUATERNARY_TDM_TX_3, \ 251 id, 1, 0, msm_routing_get_audio_mixer, \ 252 msm_routing_put_audio_mixer), \ 253 SOC_SINGLE_EXT("QUAT_TDM_TX_4", QUATERNARY_TDM_TX_4, \ 254 id, 1, 0, msm_routing_get_audio_mixer, \ 255 msm_routing_put_audio_mixer), \ 256 SOC_SINGLE_EXT("QUAT_TDM_TX_5", QUATERNARY_TDM_TX_5, \ 257 id, 1, 0, msm_routing_get_audio_mixer, \ 258 msm_routing_put_audio_mixer), \ 259 SOC_SINGLE_EXT("QUAT_TDM_TX_6", QUATERNARY_TDM_TX_6, \ 260 id, 1, 0, msm_routing_get_audio_mixer, \ 261 msm_routing_put_audio_mixer), \ 262 SOC_SINGLE_EXT("QUAT_TDM_TX_7", QUATERNARY_TDM_TX_7, \ 263 id, 1, 0, msm_routing_get_audio_mixer, \ 264 msm_routing_put_audio_mixer), \ 265 SOC_SINGLE_EXT("QUIN_TDM_TX_0", QUINARY_TDM_TX_0, \ 266 id, 1, 0, msm_routing_get_audio_mixer, \ 267 msm_routing_put_audio_mixer), \ 268 SOC_SINGLE_EXT("QUIN_TDM_TX_1", QUINARY_TDM_TX_1, \ 269 id, 1, 0, msm_routing_get_audio_mixer, \ 270 msm_routing_put_audio_mixer), \ 271 SOC_SINGLE_EXT("QUIN_TDM_TX_2", QUINARY_TDM_TX_2, \ 272 id, 1, 0, msm_routing_get_audio_mixer, \ 273 msm_routing_put_audio_mixer), \ 274 SOC_SINGLE_EXT("QUIN_TDM_TX_3", QUINARY_TDM_TX_3, \ 275 id, 1, 0, msm_routing_get_audio_mixer, \ 276 msm_routing_put_audio_mixer), \ 277 SOC_SINGLE_EXT("QUIN_TDM_TX_4", QUINARY_TDM_TX_4, \ 278 id, 1, 0, msm_routing_get_audio_mixer, \ 279 msm_routing_put_audio_mixer), \ 280 SOC_SINGLE_EXT("QUIN_TDM_TX_5", QUINARY_TDM_TX_5, \ 281 id, 1, 0, msm_routing_get_audio_mixer, \ 282 msm_routing_put_audio_mixer), \ 283 SOC_SINGLE_EXT("QUIN_TDM_TX_6", QUINARY_TDM_TX_6, \ 284 id, 1, 0, msm_routing_get_audio_mixer, \ 285 msm_routing_put_audio_mixer), \ 286 SOC_SINGLE_EXT("QUIN_TDM_TX_7", QUINARY_TDM_TX_7, \ 287 id, 1, 0, msm_routing_get_audio_mixer, \ 288 msm_routing_put_audio_mixer), \ 289 SOC_SINGLE_EXT("WSA_CODEC_DMA_TX_0", WSA_CODEC_DMA_TX_0, \ 290 id, 1, 0, msm_routing_get_audio_mixer, \ 291 msm_routing_put_audio_mixer), \ 292 SOC_SINGLE_EXT("WSA_CODEC_DMA_TX_1", WSA_CODEC_DMA_TX_1, \ 293 id, 1, 0, msm_routing_get_audio_mixer, \ 294 msm_routing_put_audio_mixer), \ 295 SOC_SINGLE_EXT("WSA_CODEC_DMA_TX_2", WSA_CODEC_DMA_TX_2, \ 296 id, 1, 0, msm_routing_get_audio_mixer, \ 297 msm_routing_put_audio_mixer), \ 298 SOC_SINGLE_EXT("VA_CODEC_DMA_TX_0", VA_CODEC_DMA_TX_0, \ 299 id, 1, 0, msm_routing_get_audio_mixer, \ 300 msm_routing_put_audio_mixer), \ 301 SOC_SINGLE_EXT("VA_CODEC_DMA_TX_1", VA_CODEC_DMA_TX_1, \ 302 id, 1, 0, msm_routing_get_audio_mixer, \ 303 msm_routing_put_audio_mixer), \ 304 SOC_SINGLE_EXT("VA_CODEC_DMA_TX_2", VA_CODEC_DMA_TX_2, \ 305 id, 1, 0, msm_routing_get_audio_mixer, \ 306 msm_routing_put_audio_mixer), \ 307 SOC_SINGLE_EXT("TX_CODEC_DMA_TX_0", TX_CODEC_DMA_TX_0, \ 308 id, 1, 0, msm_routing_get_audio_mixer, \ 309 msm_routing_put_audio_mixer), \ 310 SOC_SINGLE_EXT("TX_CODEC_DMA_TX_1", TX_CODEC_DMA_TX_1, \ 311 id, 1, 0, msm_routing_get_audio_mixer, \ 312 msm_routing_put_audio_mixer), \ 313 SOC_SINGLE_EXT("TX_CODEC_DMA_TX_2", TX_CODEC_DMA_TX_2, \ 314 id, 1, 0, msm_routing_get_audio_mixer, \ 315 msm_routing_put_audio_mixer), \ 316 SOC_SINGLE_EXT("TX_CODEC_DMA_TX_3", TX_CODEC_DMA_TX_3, \ 317 id, 1, 0, msm_routing_get_audio_mixer, \ 318 msm_routing_put_audio_mixer), \ 319 SOC_SINGLE_EXT("TX_CODEC_DMA_TX_4", TX_CODEC_DMA_TX_4, \ 320 id, 1, 0, msm_routing_get_audio_mixer, \ 321 msm_routing_put_audio_mixer), \ 322 SOC_SINGLE_EXT("TX_CODEC_DMA_TX_5", TX_CODEC_DMA_TX_5, \ 323 id, 1, 0, msm_routing_get_audio_mixer, \ 324 msm_routing_put_audio_mixer), 325 326 struct session_data { 327 int state; 328 int port_id; 329 int path_type; 330 int app_type; 331 int acdb_id; 332 int sample_rate; 333 int bits_per_sample; 334 int channels; 335 int perf_mode; 336 int numcopps; 337 int fedai_id; 338 unsigned long copp_map; 339 struct q6copp *copps[MAX_COPPS_PER_PORT]; 340 }; 341 342 struct msm_routing_data { 343 struct session_data sessions[MAX_SESSIONS]; 344 struct session_data port_data[AFE_MAX_PORTS]; 345 struct device *dev; 346 struct mutex lock; 347 }; 348 349 static struct msm_routing_data *routing_data; 350 351 /** 352 * q6routing_stream_open() - Register a new stream for route setup 353 * 354 * @fedai_id: Frontend dai id. 355 * @perf_mode: Performance mode. 356 * @stream_id: ASM stream id to map. 357 * @stream_type: Direction of stream 358 * 359 * Return: Will be an negative on error or a zero on success. 360 */ 361 int q6routing_stream_open(int fedai_id, int perf_mode, 362 int stream_id, int stream_type) 363 { 364 int j, topology, num_copps = 0; 365 struct route_payload payload; 366 struct q6copp *copp; 367 int copp_idx; 368 struct session_data *session, *pdata; 369 370 if (!routing_data) { 371 pr_err("Routing driver not yet ready\n"); 372 return -EINVAL; 373 } 374 375 session = &routing_data->sessions[stream_id - 1]; 376 if (session->port_id < 0) { 377 dev_err(routing_data->dev, "Routing not setup for MultiMedia%d Session\n", 378 session->fedai_id); 379 return -EINVAL; 380 } 381 382 pdata = &routing_data->port_data[session->port_id]; 383 384 mutex_lock(&routing_data->lock); 385 session->fedai_id = fedai_id; 386 387 session->path_type = pdata->path_type; 388 session->sample_rate = pdata->sample_rate; 389 session->channels = pdata->channels; 390 session->bits_per_sample = pdata->bits_per_sample; 391 392 payload.num_copps = 0; /* only RX needs to use payload */ 393 topology = NULL_COPP_TOPOLOGY; 394 copp = q6adm_open(routing_data->dev, session->port_id, 395 session->path_type, session->sample_rate, 396 session->channels, topology, perf_mode, 397 session->bits_per_sample, 0, 0); 398 399 if (IS_ERR_OR_NULL(copp)) { 400 mutex_unlock(&routing_data->lock); 401 return -EINVAL; 402 } 403 404 copp_idx = q6adm_get_copp_id(copp); 405 set_bit(copp_idx, &session->copp_map); 406 session->copps[copp_idx] = copp; 407 408 for_each_set_bit(j, &session->copp_map, MAX_COPPS_PER_PORT) { 409 payload.port_id[num_copps] = session->port_id; 410 payload.copp_idx[num_copps] = j; 411 num_copps++; 412 } 413 414 if (num_copps) { 415 payload.num_copps = num_copps; 416 payload.session_id = stream_id; 417 q6adm_matrix_map(routing_data->dev, session->path_type, 418 payload, perf_mode); 419 } 420 mutex_unlock(&routing_data->lock); 421 422 return 0; 423 } 424 EXPORT_SYMBOL_GPL(q6routing_stream_open); 425 426 static struct session_data *get_session_from_id(struct msm_routing_data *data, 427 int fedai_id) 428 { 429 int i; 430 431 for (i = 0; i < MAX_SESSIONS; i++) { 432 if (fedai_id == data->sessions[i].fedai_id) 433 return &data->sessions[i]; 434 } 435 436 return NULL; 437 } 438 /** 439 * q6routing_stream_close() - Deregister a stream 440 * 441 * @fedai_id: Frontend dai id. 442 * @stream_type: Direction of stream 443 * 444 * Return: Will be an negative on error or a zero on success. 445 */ 446 void q6routing_stream_close(int fedai_id, int stream_type) 447 { 448 struct session_data *session; 449 int idx; 450 451 session = get_session_from_id(routing_data, fedai_id); 452 if (!session) 453 return; 454 455 for_each_set_bit(idx, &session->copp_map, MAX_COPPS_PER_PORT) { 456 if (session->copps[idx]) { 457 q6adm_close(routing_data->dev, session->copps[idx]); 458 session->copps[idx] = NULL; 459 } 460 } 461 462 session->fedai_id = -1; 463 session->copp_map = 0; 464 } 465 EXPORT_SYMBOL_GPL(q6routing_stream_close); 466 467 static int msm_routing_get_audio_mixer(struct snd_kcontrol *kcontrol, 468 struct snd_ctl_elem_value *ucontrol) 469 { 470 struct snd_soc_dapm_context *dapm = 471 snd_soc_dapm_kcontrol_dapm(kcontrol); 472 struct soc_mixer_control *mc = 473 (struct soc_mixer_control *)kcontrol->private_value; 474 int session_id = mc->shift; 475 struct snd_soc_component *c = snd_soc_dapm_to_component(dapm); 476 struct msm_routing_data *priv = dev_get_drvdata(c->dev); 477 struct session_data *session = &priv->sessions[session_id]; 478 479 if (session->port_id == mc->reg) 480 ucontrol->value.integer.value[0] = 1; 481 else 482 ucontrol->value.integer.value[0] = 0; 483 484 return 0; 485 } 486 487 static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol, 488 struct snd_ctl_elem_value *ucontrol) 489 { 490 struct snd_soc_dapm_context *dapm = 491 snd_soc_dapm_kcontrol_dapm(kcontrol); 492 struct snd_soc_component *c = snd_soc_dapm_to_component(dapm); 493 struct msm_routing_data *data = dev_get_drvdata(c->dev); 494 struct soc_mixer_control *mc = 495 (struct soc_mixer_control *)kcontrol->private_value; 496 struct snd_soc_dapm_update *update = NULL; 497 int be_id = mc->reg; 498 int session_id = mc->shift; 499 struct session_data *session = &data->sessions[session_id]; 500 501 if (ucontrol->value.integer.value[0]) { 502 if (session->port_id == be_id) 503 return 0; 504 505 session->port_id = be_id; 506 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update); 507 } else { 508 if (session->port_id == -1 || session->port_id != be_id) 509 return 0; 510 511 session->port_id = -1; 512 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update); 513 } 514 515 return 1; 516 } 517 518 static const struct snd_kcontrol_new hdmi_mixer_controls[] = { 519 Q6ROUTING_RX_MIXERS(HDMI_RX) }; 520 521 static const struct snd_kcontrol_new display_port_mixer_controls[] = { 522 Q6ROUTING_RX_MIXERS(DISPLAY_PORT_RX) }; 523 524 static const struct snd_kcontrol_new primary_mi2s_rx_mixer_controls[] = { 525 Q6ROUTING_RX_MIXERS(PRIMARY_MI2S_RX) }; 526 527 static const struct snd_kcontrol_new secondary_mi2s_rx_mixer_controls[] = { 528 Q6ROUTING_RX_MIXERS(SECONDARY_MI2S_RX) }; 529 530 static const struct snd_kcontrol_new quaternary_mi2s_rx_mixer_controls[] = { 531 Q6ROUTING_RX_MIXERS(QUATERNARY_MI2S_RX) }; 532 533 static const struct snd_kcontrol_new quinary_mi2s_rx_mixer_controls[] = { 534 Q6ROUTING_RX_MIXERS(QUINARY_MI2S_RX) }; 535 536 static const struct snd_kcontrol_new tertiary_mi2s_rx_mixer_controls[] = { 537 Q6ROUTING_RX_MIXERS(TERTIARY_MI2S_RX) }; 538 539 static const struct snd_kcontrol_new slimbus_rx_mixer_controls[] = { 540 Q6ROUTING_RX_MIXERS(SLIMBUS_0_RX) }; 541 542 static const struct snd_kcontrol_new slimbus_1_rx_mixer_controls[] = { 543 Q6ROUTING_RX_MIXERS(SLIMBUS_1_RX) }; 544 545 static const struct snd_kcontrol_new slimbus_2_rx_mixer_controls[] = { 546 Q6ROUTING_RX_MIXERS(SLIMBUS_2_RX) }; 547 548 static const struct snd_kcontrol_new slimbus_3_rx_mixer_controls[] = { 549 Q6ROUTING_RX_MIXERS(SLIMBUS_3_RX) }; 550 551 static const struct snd_kcontrol_new slimbus_4_rx_mixer_controls[] = { 552 Q6ROUTING_RX_MIXERS(SLIMBUS_4_RX) }; 553 554 static const struct snd_kcontrol_new slimbus_5_rx_mixer_controls[] = { 555 Q6ROUTING_RX_MIXERS(SLIMBUS_5_RX) }; 556 557 static const struct snd_kcontrol_new slimbus_6_rx_mixer_controls[] = { 558 Q6ROUTING_RX_MIXERS(SLIMBUS_6_RX) }; 559 560 static const struct snd_kcontrol_new pri_tdm_rx_0_mixer_controls[] = { 561 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_0) }; 562 563 static const struct snd_kcontrol_new pri_tdm_rx_1_mixer_controls[] = { 564 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_1) }; 565 566 static const struct snd_kcontrol_new pri_tdm_rx_2_mixer_controls[] = { 567 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_2) }; 568 569 static const struct snd_kcontrol_new pri_tdm_rx_3_mixer_controls[] = { 570 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_3) }; 571 572 static const struct snd_kcontrol_new pri_tdm_rx_4_mixer_controls[] = { 573 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_4) }; 574 575 static const struct snd_kcontrol_new pri_tdm_rx_5_mixer_controls[] = { 576 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_5) }; 577 578 static const struct snd_kcontrol_new pri_tdm_rx_6_mixer_controls[] = { 579 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_6) }; 580 581 static const struct snd_kcontrol_new pri_tdm_rx_7_mixer_controls[] = { 582 Q6ROUTING_RX_MIXERS(PRIMARY_TDM_RX_7) }; 583 584 static const struct snd_kcontrol_new sec_tdm_rx_0_mixer_controls[] = { 585 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_0) }; 586 587 static const struct snd_kcontrol_new sec_tdm_rx_1_mixer_controls[] = { 588 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_1) }; 589 590 static const struct snd_kcontrol_new sec_tdm_rx_2_mixer_controls[] = { 591 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_2) }; 592 593 static const struct snd_kcontrol_new sec_tdm_rx_3_mixer_controls[] = { 594 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_3) }; 595 596 static const struct snd_kcontrol_new sec_tdm_rx_4_mixer_controls[] = { 597 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_4) }; 598 599 static const struct snd_kcontrol_new sec_tdm_rx_5_mixer_controls[] = { 600 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_5) }; 601 602 static const struct snd_kcontrol_new sec_tdm_rx_6_mixer_controls[] = { 603 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_6) }; 604 605 static const struct snd_kcontrol_new sec_tdm_rx_7_mixer_controls[] = { 606 Q6ROUTING_RX_MIXERS(SECONDARY_TDM_RX_7) }; 607 608 static const struct snd_kcontrol_new tert_tdm_rx_0_mixer_controls[] = { 609 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_0) }; 610 611 static const struct snd_kcontrol_new tert_tdm_rx_1_mixer_controls[] = { 612 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_1) }; 613 614 static const struct snd_kcontrol_new tert_tdm_rx_2_mixer_controls[] = { 615 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_2) }; 616 617 static const struct snd_kcontrol_new tert_tdm_rx_3_mixer_controls[] = { 618 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_3) }; 619 620 static const struct snd_kcontrol_new tert_tdm_rx_4_mixer_controls[] = { 621 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_4) }; 622 623 static const struct snd_kcontrol_new tert_tdm_rx_5_mixer_controls[] = { 624 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_5) }; 625 626 static const struct snd_kcontrol_new tert_tdm_rx_6_mixer_controls[] = { 627 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_6) }; 628 629 static const struct snd_kcontrol_new tert_tdm_rx_7_mixer_controls[] = { 630 Q6ROUTING_RX_MIXERS(TERTIARY_TDM_RX_7) }; 631 632 static const struct snd_kcontrol_new quat_tdm_rx_0_mixer_controls[] = { 633 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_0) }; 634 635 static const struct snd_kcontrol_new quat_tdm_rx_1_mixer_controls[] = { 636 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_1) }; 637 638 static const struct snd_kcontrol_new quat_tdm_rx_2_mixer_controls[] = { 639 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_2) }; 640 641 static const struct snd_kcontrol_new quat_tdm_rx_3_mixer_controls[] = { 642 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_3) }; 643 644 static const struct snd_kcontrol_new quat_tdm_rx_4_mixer_controls[] = { 645 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_4) }; 646 647 static const struct snd_kcontrol_new quat_tdm_rx_5_mixer_controls[] = { 648 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_5) }; 649 650 static const struct snd_kcontrol_new quat_tdm_rx_6_mixer_controls[] = { 651 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_6) }; 652 653 static const struct snd_kcontrol_new quat_tdm_rx_7_mixer_controls[] = { 654 Q6ROUTING_RX_MIXERS(QUATERNARY_TDM_RX_7) }; 655 656 static const struct snd_kcontrol_new quin_tdm_rx_0_mixer_controls[] = { 657 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_0) }; 658 659 static const struct snd_kcontrol_new quin_tdm_rx_1_mixer_controls[] = { 660 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_1) }; 661 662 static const struct snd_kcontrol_new quin_tdm_rx_2_mixer_controls[] = { 663 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_2) }; 664 665 static const struct snd_kcontrol_new quin_tdm_rx_3_mixer_controls[] = { 666 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_3) }; 667 668 static const struct snd_kcontrol_new quin_tdm_rx_4_mixer_controls[] = { 669 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_4) }; 670 671 static const struct snd_kcontrol_new quin_tdm_rx_5_mixer_controls[] = { 672 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_5) }; 673 674 static const struct snd_kcontrol_new quin_tdm_rx_6_mixer_controls[] = { 675 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_6) }; 676 677 static const struct snd_kcontrol_new quin_tdm_rx_7_mixer_controls[] = { 678 Q6ROUTING_RX_MIXERS(QUINARY_TDM_RX_7) }; 679 680 static const struct snd_kcontrol_new wsa_codec_dma_rx_0_mixer_controls[] = { 681 Q6ROUTING_RX_MIXERS(WSA_CODEC_DMA_RX_0) }; 682 683 static const struct snd_kcontrol_new wsa_codec_dma_rx_1_mixer_controls[] = { 684 Q6ROUTING_RX_MIXERS(WSA_CODEC_DMA_RX_1) }; 685 686 static const struct snd_kcontrol_new rx_codec_dma_rx_0_mixer_controls[] = { 687 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_0) }; 688 689 static const struct snd_kcontrol_new rx_codec_dma_rx_1_mixer_controls[] = { 690 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_1) }; 691 692 static const struct snd_kcontrol_new rx_codec_dma_rx_2_mixer_controls[] = { 693 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_2) }; 694 695 static const struct snd_kcontrol_new rx_codec_dma_rx_3_mixer_controls[] = { 696 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_3) }; 697 698 static const struct snd_kcontrol_new rx_codec_dma_rx_4_mixer_controls[] = { 699 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_4) }; 700 701 static const struct snd_kcontrol_new rx_codec_dma_rx_5_mixer_controls[] = { 702 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_5) }; 703 704 static const struct snd_kcontrol_new rxcodec_dma_rx_6_mixer_controls[] = { 705 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_6) }; 706 707 static const struct snd_kcontrol_new rx_codec_dma_rx_7_mixer_controls[] = { 708 Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_7) }; 709 710 711 static const struct snd_kcontrol_new mmul1_mixer_controls[] = { 712 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA1) }; 713 714 static const struct snd_kcontrol_new mmul2_mixer_controls[] = { 715 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA2) }; 716 717 static const struct snd_kcontrol_new mmul3_mixer_controls[] = { 718 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA3) }; 719 720 static const struct snd_kcontrol_new mmul4_mixer_controls[] = { 721 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA4) }; 722 723 static const struct snd_kcontrol_new mmul5_mixer_controls[] = { 724 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA5) }; 725 726 static const struct snd_kcontrol_new mmul6_mixer_controls[] = { 727 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA6) }; 728 729 static const struct snd_kcontrol_new mmul7_mixer_controls[] = { 730 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA7) }; 731 732 static const struct snd_kcontrol_new mmul8_mixer_controls[] = { 733 Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA8) }; 734 735 static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = { 736 /* Mixer definitions */ 737 SND_SOC_DAPM_MIXER("HDMI Mixer", SND_SOC_NOPM, 0, 0, 738 hdmi_mixer_controls, 739 ARRAY_SIZE(hdmi_mixer_controls)), 740 741 SND_SOC_DAPM_MIXER("DISPLAY_PORT_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 742 display_port_mixer_controls, 743 ARRAY_SIZE(display_port_mixer_controls)), 744 745 SND_SOC_DAPM_MIXER("SLIMBUS_0_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 746 slimbus_rx_mixer_controls, 747 ARRAY_SIZE(slimbus_rx_mixer_controls)), 748 SND_SOC_DAPM_MIXER("SLIMBUS_1_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 749 slimbus_1_rx_mixer_controls, 750 ARRAY_SIZE(slimbus_1_rx_mixer_controls)), 751 SND_SOC_DAPM_MIXER("SLIMBUS_2_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 752 slimbus_2_rx_mixer_controls, 753 ARRAY_SIZE(slimbus_2_rx_mixer_controls)), 754 SND_SOC_DAPM_MIXER("SLIMBUS_3_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 755 slimbus_3_rx_mixer_controls, 756 ARRAY_SIZE(slimbus_3_rx_mixer_controls)), 757 SND_SOC_DAPM_MIXER("SLIMBUS_4_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 758 slimbus_4_rx_mixer_controls, 759 ARRAY_SIZE(slimbus_4_rx_mixer_controls)), 760 SND_SOC_DAPM_MIXER("SLIMBUS_5_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 761 slimbus_5_rx_mixer_controls, 762 ARRAY_SIZE(slimbus_5_rx_mixer_controls)), 763 SND_SOC_DAPM_MIXER("SLIMBUS_6_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 764 slimbus_6_rx_mixer_controls, 765 ARRAY_SIZE(slimbus_6_rx_mixer_controls)), 766 SND_SOC_DAPM_MIXER("PRI_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 767 primary_mi2s_rx_mixer_controls, 768 ARRAY_SIZE(primary_mi2s_rx_mixer_controls)), 769 SND_SOC_DAPM_MIXER("SEC_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 770 secondary_mi2s_rx_mixer_controls, 771 ARRAY_SIZE(secondary_mi2s_rx_mixer_controls)), 772 SND_SOC_DAPM_MIXER("QUAT_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 773 quaternary_mi2s_rx_mixer_controls, 774 ARRAY_SIZE(quaternary_mi2s_rx_mixer_controls)), 775 SND_SOC_DAPM_MIXER("QUIN_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 776 quinary_mi2s_rx_mixer_controls, 777 ARRAY_SIZE(quinary_mi2s_rx_mixer_controls)), 778 SND_SOC_DAPM_MIXER("TERT_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, 779 tertiary_mi2s_rx_mixer_controls, 780 ARRAY_SIZE(tertiary_mi2s_rx_mixer_controls)), 781 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 782 pri_tdm_rx_0_mixer_controls, 783 ARRAY_SIZE(pri_tdm_rx_0_mixer_controls)), 784 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 785 pri_tdm_rx_1_mixer_controls, 786 ARRAY_SIZE(pri_tdm_rx_1_mixer_controls)), 787 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0, 788 pri_tdm_rx_2_mixer_controls, 789 ARRAY_SIZE(pri_tdm_rx_2_mixer_controls)), 790 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0, 791 pri_tdm_rx_3_mixer_controls, 792 ARRAY_SIZE(pri_tdm_rx_3_mixer_controls)), 793 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0, 794 pri_tdm_rx_4_mixer_controls, 795 ARRAY_SIZE(pri_tdm_rx_4_mixer_controls)), 796 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0, 797 pri_tdm_rx_5_mixer_controls, 798 ARRAY_SIZE(pri_tdm_rx_5_mixer_controls)), 799 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0, 800 pri_tdm_rx_6_mixer_controls, 801 ARRAY_SIZE(pri_tdm_rx_6_mixer_controls)), 802 SND_SOC_DAPM_MIXER("PRIMARY_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0, 803 pri_tdm_rx_7_mixer_controls, 804 ARRAY_SIZE(pri_tdm_rx_7_mixer_controls)), 805 806 SND_SOC_DAPM_MIXER("SEC_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 807 sec_tdm_rx_0_mixer_controls, 808 ARRAY_SIZE(sec_tdm_rx_0_mixer_controls)), 809 SND_SOC_DAPM_MIXER("SEC_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 810 sec_tdm_rx_1_mixer_controls, 811 ARRAY_SIZE(sec_tdm_rx_1_mixer_controls)), 812 SND_SOC_DAPM_MIXER("SEC_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0, 813 sec_tdm_rx_2_mixer_controls, 814 ARRAY_SIZE(sec_tdm_rx_2_mixer_controls)), 815 SND_SOC_DAPM_MIXER("SEC_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0, 816 sec_tdm_rx_3_mixer_controls, 817 ARRAY_SIZE(sec_tdm_rx_3_mixer_controls)), 818 SND_SOC_DAPM_MIXER("SEC_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0, 819 sec_tdm_rx_4_mixer_controls, 820 ARRAY_SIZE(sec_tdm_rx_4_mixer_controls)), 821 SND_SOC_DAPM_MIXER("SEC_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0, 822 sec_tdm_rx_5_mixer_controls, 823 ARRAY_SIZE(sec_tdm_rx_5_mixer_controls)), 824 SND_SOC_DAPM_MIXER("SEC_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0, 825 sec_tdm_rx_6_mixer_controls, 826 ARRAY_SIZE(sec_tdm_rx_6_mixer_controls)), 827 SND_SOC_DAPM_MIXER("SEC_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0, 828 sec_tdm_rx_7_mixer_controls, 829 ARRAY_SIZE(sec_tdm_rx_7_mixer_controls)), 830 831 SND_SOC_DAPM_MIXER("TERT_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 832 tert_tdm_rx_0_mixer_controls, 833 ARRAY_SIZE(tert_tdm_rx_0_mixer_controls)), 834 SND_SOC_DAPM_MIXER("TERT_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 835 tert_tdm_rx_1_mixer_controls, 836 ARRAY_SIZE(tert_tdm_rx_1_mixer_controls)), 837 SND_SOC_DAPM_MIXER("TERT_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0, 838 tert_tdm_rx_2_mixer_controls, 839 ARRAY_SIZE(tert_tdm_rx_2_mixer_controls)), 840 SND_SOC_DAPM_MIXER("TERT_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0, 841 tert_tdm_rx_3_mixer_controls, 842 ARRAY_SIZE(tert_tdm_rx_3_mixer_controls)), 843 SND_SOC_DAPM_MIXER("TERT_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0, 844 tert_tdm_rx_4_mixer_controls, 845 ARRAY_SIZE(tert_tdm_rx_4_mixer_controls)), 846 SND_SOC_DAPM_MIXER("TERT_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0, 847 tert_tdm_rx_5_mixer_controls, 848 ARRAY_SIZE(tert_tdm_rx_5_mixer_controls)), 849 SND_SOC_DAPM_MIXER("TERT_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0, 850 tert_tdm_rx_6_mixer_controls, 851 ARRAY_SIZE(tert_tdm_rx_6_mixer_controls)), 852 SND_SOC_DAPM_MIXER("TERT_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0, 853 tert_tdm_rx_7_mixer_controls, 854 ARRAY_SIZE(tert_tdm_rx_7_mixer_controls)), 855 856 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 857 quat_tdm_rx_0_mixer_controls, 858 ARRAY_SIZE(quat_tdm_rx_0_mixer_controls)), 859 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 860 quat_tdm_rx_1_mixer_controls, 861 ARRAY_SIZE(quat_tdm_rx_1_mixer_controls)), 862 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0, 863 quat_tdm_rx_2_mixer_controls, 864 ARRAY_SIZE(quat_tdm_rx_2_mixer_controls)), 865 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0, 866 quat_tdm_rx_3_mixer_controls, 867 ARRAY_SIZE(quat_tdm_rx_3_mixer_controls)), 868 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0, 869 quat_tdm_rx_4_mixer_controls, 870 ARRAY_SIZE(quat_tdm_rx_4_mixer_controls)), 871 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0, 872 quat_tdm_rx_5_mixer_controls, 873 ARRAY_SIZE(quat_tdm_rx_5_mixer_controls)), 874 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0, 875 quat_tdm_rx_6_mixer_controls, 876 ARRAY_SIZE(quat_tdm_rx_6_mixer_controls)), 877 SND_SOC_DAPM_MIXER("QUAT_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0, 878 quat_tdm_rx_7_mixer_controls, 879 ARRAY_SIZE(quat_tdm_rx_7_mixer_controls)), 880 881 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 882 quin_tdm_rx_0_mixer_controls, 883 ARRAY_SIZE(quin_tdm_rx_0_mixer_controls)), 884 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 885 quin_tdm_rx_1_mixer_controls, 886 ARRAY_SIZE(quin_tdm_rx_1_mixer_controls)), 887 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0, 888 quin_tdm_rx_2_mixer_controls, 889 ARRAY_SIZE(quin_tdm_rx_2_mixer_controls)), 890 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0, 891 quin_tdm_rx_3_mixer_controls, 892 ARRAY_SIZE(quin_tdm_rx_3_mixer_controls)), 893 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0, 894 quin_tdm_rx_4_mixer_controls, 895 ARRAY_SIZE(quin_tdm_rx_4_mixer_controls)), 896 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0, 897 quin_tdm_rx_5_mixer_controls, 898 ARRAY_SIZE(quin_tdm_rx_5_mixer_controls)), 899 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0, 900 quin_tdm_rx_6_mixer_controls, 901 ARRAY_SIZE(quin_tdm_rx_6_mixer_controls)), 902 SND_SOC_DAPM_MIXER("QUIN_TDM_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0, 903 quin_tdm_rx_7_mixer_controls, 904 ARRAY_SIZE(quin_tdm_rx_7_mixer_controls)), 905 906 SND_SOC_DAPM_MIXER("WSA_CODEC_DMA_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 907 wsa_codec_dma_rx_0_mixer_controls, 908 ARRAY_SIZE(wsa_codec_dma_rx_0_mixer_controls)), 909 SND_SOC_DAPM_MIXER("WSA_CODEC_DMA_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 910 wsa_codec_dma_rx_1_mixer_controls, 911 ARRAY_SIZE(wsa_codec_dma_rx_1_mixer_controls)), 912 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_0 Audio Mixer", SND_SOC_NOPM, 0, 0, 913 rx_codec_dma_rx_0_mixer_controls, 914 ARRAY_SIZE(rx_codec_dma_rx_0_mixer_controls)), 915 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_1 Audio Mixer", SND_SOC_NOPM, 0, 0, 916 rx_codec_dma_rx_1_mixer_controls, 917 ARRAY_SIZE(rx_codec_dma_rx_1_mixer_controls)), 918 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_2 Audio Mixer", SND_SOC_NOPM, 0, 0, 919 rx_codec_dma_rx_2_mixer_controls, 920 ARRAY_SIZE(rx_codec_dma_rx_2_mixer_controls)), 921 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_3 Audio Mixer", SND_SOC_NOPM, 0, 0, 922 rx_codec_dma_rx_3_mixer_controls, 923 ARRAY_SIZE(rx_codec_dma_rx_3_mixer_controls)), 924 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_4 Audio Mixer", SND_SOC_NOPM, 0, 0, 925 rx_codec_dma_rx_4_mixer_controls, 926 ARRAY_SIZE(rx_codec_dma_rx_4_mixer_controls)), 927 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_5 Audio Mixer", SND_SOC_NOPM, 0, 0, 928 rx_codec_dma_rx_5_mixer_controls, 929 ARRAY_SIZE(rx_codec_dma_rx_5_mixer_controls)), 930 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_6 Audio Mixer", SND_SOC_NOPM, 0, 0, 931 rxcodec_dma_rx_6_mixer_controls, 932 ARRAY_SIZE(rxcodec_dma_rx_6_mixer_controls)), 933 SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0, 934 rx_codec_dma_rx_7_mixer_controls, 935 ARRAY_SIZE(rx_codec_dma_rx_7_mixer_controls)), 936 SND_SOC_DAPM_MIXER("MultiMedia1 Mixer", SND_SOC_NOPM, 0, 0, 937 mmul1_mixer_controls, ARRAY_SIZE(mmul1_mixer_controls)), 938 SND_SOC_DAPM_MIXER("MultiMedia2 Mixer", SND_SOC_NOPM, 0, 0, 939 mmul2_mixer_controls, ARRAY_SIZE(mmul2_mixer_controls)), 940 SND_SOC_DAPM_MIXER("MultiMedia3 Mixer", SND_SOC_NOPM, 0, 0, 941 mmul3_mixer_controls, ARRAY_SIZE(mmul3_mixer_controls)), 942 SND_SOC_DAPM_MIXER("MultiMedia4 Mixer", SND_SOC_NOPM, 0, 0, 943 mmul4_mixer_controls, ARRAY_SIZE(mmul4_mixer_controls)), 944 SND_SOC_DAPM_MIXER("MultiMedia5 Mixer", SND_SOC_NOPM, 0, 0, 945 mmul5_mixer_controls, ARRAY_SIZE(mmul5_mixer_controls)), 946 SND_SOC_DAPM_MIXER("MultiMedia6 Mixer", SND_SOC_NOPM, 0, 0, 947 mmul6_mixer_controls, ARRAY_SIZE(mmul6_mixer_controls)), 948 SND_SOC_DAPM_MIXER("MultiMedia7 Mixer", SND_SOC_NOPM, 0, 0, 949 mmul7_mixer_controls, ARRAY_SIZE(mmul7_mixer_controls)), 950 SND_SOC_DAPM_MIXER("MultiMedia8 Mixer", SND_SOC_NOPM, 0, 0, 951 mmul8_mixer_controls, ARRAY_SIZE(mmul8_mixer_controls)), 952 953 }; 954 955 static const struct snd_soc_dapm_route intercon[] = { 956 Q6ROUTING_RX_DAPM_ROUTE("HDMI Mixer", "HDMI_RX"), 957 Q6ROUTING_RX_DAPM_ROUTE("DISPLAY_PORT_RX Audio Mixer", 958 "DISPLAY_PORT_RX"), 959 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_0_RX Audio Mixer", "SLIMBUS_0_RX"), 960 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_1_RX Audio Mixer", "SLIMBUS_1_RX"), 961 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_2_RX Audio Mixer", "SLIMBUS_2_RX"), 962 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_3_RX Audio Mixer", "SLIMBUS_3_RX"), 963 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_4_RX Audio Mixer", "SLIMBUS_4_RX"), 964 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_5_RX Audio Mixer", "SLIMBUS_5_RX"), 965 Q6ROUTING_RX_DAPM_ROUTE("SLIMBUS_6_RX Audio Mixer", "SLIMBUS_6_RX"), 966 Q6ROUTING_RX_DAPM_ROUTE("QUAT_MI2S_RX Audio Mixer", "QUAT_MI2S_RX"), 967 Q6ROUTING_RX_DAPM_ROUTE("QUIN_MI2S_RX Audio Mixer", "QUIN_MI2S_RX"), 968 Q6ROUTING_RX_DAPM_ROUTE("TERT_MI2S_RX Audio Mixer", "TERT_MI2S_RX"), 969 Q6ROUTING_RX_DAPM_ROUTE("SEC_MI2S_RX Audio Mixer", "SEC_MI2S_RX"), 970 Q6ROUTING_RX_DAPM_ROUTE("PRI_MI2S_RX Audio Mixer", "PRI_MI2S_RX"), 971 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_0 Audio Mixer", 972 "PRIMARY_TDM_RX_0"), 973 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_1 Audio Mixer", 974 "PRIMARY_TDM_RX_1"), 975 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_2 Audio Mixer", 976 "PRIMARY_TDM_RX_2"), 977 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_3 Audio Mixer", 978 "PRIMARY_TDM_RX_3"), 979 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_4 Audio Mixer", 980 "PRIMARY_TDM_RX_4"), 981 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_5 Audio Mixer", 982 "PRIMARY_TDM_RX_5"), 983 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_6 Audio Mixer", 984 "PRIMARY_TDM_RX_6"), 985 Q6ROUTING_RX_DAPM_ROUTE("PRIMARY_TDM_RX_7 Audio Mixer", 986 "PRIMARY_TDM_RX_7"), 987 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_0 Audio Mixer", "SEC_TDM_RX_0"), 988 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_1 Audio Mixer", "SEC_TDM_RX_1"), 989 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_2 Audio Mixer", "SEC_TDM_RX_2"), 990 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_3 Audio Mixer", "SEC_TDM_RX_3"), 991 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_4 Audio Mixer", "SEC_TDM_RX_4"), 992 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_5 Audio Mixer", "SEC_TDM_RX_5"), 993 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_6 Audio Mixer", "SEC_TDM_RX_6"), 994 Q6ROUTING_RX_DAPM_ROUTE("SEC_TDM_RX_7 Audio Mixer", "SEC_TDM_RX_7"), 995 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_0 Audio Mixer", "TERT_TDM_RX_0"), 996 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_1 Audio Mixer", "TERT_TDM_RX_1"), 997 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_2 Audio Mixer", "TERT_TDM_RX_2"), 998 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_3 Audio Mixer", "TERT_TDM_RX_3"), 999 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_4 Audio Mixer", "TERT_TDM_RX_4"), 1000 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_5 Audio Mixer", "TERT_TDM_RX_5"), 1001 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_6 Audio Mixer", "TERT_TDM_RX_6"), 1002 Q6ROUTING_RX_DAPM_ROUTE("TERT_TDM_RX_7 Audio Mixer", "TERT_TDM_RX_7"), 1003 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_0 Audio Mixer", "QUAT_TDM_RX_0"), 1004 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_1 Audio Mixer", "QUAT_TDM_RX_1"), 1005 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_2 Audio Mixer", "QUAT_TDM_RX_2"), 1006 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_3 Audio Mixer", "QUAT_TDM_RX_3"), 1007 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_4 Audio Mixer", "QUAT_TDM_RX_4"), 1008 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_5 Audio Mixer", "QUAT_TDM_RX_5"), 1009 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_6 Audio Mixer", "QUAT_TDM_RX_6"), 1010 Q6ROUTING_RX_DAPM_ROUTE("QUAT_TDM_RX_7 Audio Mixer", "QUAT_TDM_RX_7"), 1011 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_0 Audio Mixer", "QUIN_TDM_RX_0"), 1012 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_1 Audio Mixer", "QUIN_TDM_RX_1"), 1013 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_2 Audio Mixer", "QUIN_TDM_RX_2"), 1014 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_3 Audio Mixer", "QUIN_TDM_RX_3"), 1015 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_4 Audio Mixer", "QUIN_TDM_RX_4"), 1016 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_5 Audio Mixer", "QUIN_TDM_RX_5"), 1017 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_6 Audio Mixer", "QUIN_TDM_RX_6"), 1018 Q6ROUTING_RX_DAPM_ROUTE("QUIN_TDM_RX_7 Audio Mixer", "QUIN_TDM_RX_7"), 1019 Q6ROUTING_RX_DAPM_ROUTE("WSA_CODEC_DMA_RX_0 Audio Mixer", "WSA_CODEC_DMA_RX_0"), 1020 Q6ROUTING_RX_DAPM_ROUTE("WSA_CODEC_DMA_RX_1 Audio Mixer", "WSA_CODEC_DMA_RX_1"), 1021 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_0 Audio Mixer", "RX_CODEC_DMA_RX_0"), 1022 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_1 Audio Mixer", "RX_CODEC_DMA_RX_1"), 1023 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_2 Audio Mixer", "RX_CODEC_DMA_RX_2"), 1024 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_3 Audio Mixer", "RX_CODEC_DMA_RX_3"), 1025 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_4 Audio Mixer", "RX_CODEC_DMA_RX_4"), 1026 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_5 Audio Mixer", "RX_CODEC_DMA_RX_5"), 1027 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_6 Audio Mixer", "RX_CODEC_DMA_RX_6"), 1028 Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_7 Audio Mixer", "RX_CODEC_DMA_RX_7"), 1029 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia1 Mixer"), 1030 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia2 Mixer"), 1031 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia3 Mixer"), 1032 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia4 Mixer"), 1033 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia5 Mixer"), 1034 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia6 Mixer"), 1035 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia7 Mixer"), 1036 Q6ROUTING_TX_DAPM_ROUTE("MultiMedia8 Mixer"), 1037 1038 {"MM_UL1", NULL, "MultiMedia1 Mixer"}, 1039 {"MM_UL2", NULL, "MultiMedia2 Mixer"}, 1040 {"MM_UL3", NULL, "MultiMedia3 Mixer"}, 1041 {"MM_UL4", NULL, "MultiMedia4 Mixer"}, 1042 {"MM_UL5", NULL, "MultiMedia5 Mixer"}, 1043 {"MM_UL6", NULL, "MultiMedia6 Mixer"}, 1044 {"MM_UL7", NULL, "MultiMedia7 Mixer"}, 1045 {"MM_UL8", NULL, "MultiMedia8 Mixer"}, 1046 }; 1047 1048 static int routing_hw_params(struct snd_soc_component *component, 1049 struct snd_pcm_substream *substream, 1050 struct snd_pcm_hw_params *params) 1051 { 1052 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 1053 struct msm_routing_data *data = dev_get_drvdata(component->dev); 1054 unsigned int be_id = snd_soc_rtd_to_cpu(rtd, 0)->id; 1055 struct session_data *session; 1056 int path_type; 1057 1058 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1059 path_type = ADM_PATH_PLAYBACK; 1060 else 1061 path_type = ADM_PATH_LIVE_REC; 1062 1063 if (be_id >= AFE_MAX_PORTS) 1064 return -EINVAL; 1065 1066 session = &data->port_data[be_id]; 1067 1068 mutex_lock(&data->lock); 1069 1070 session->path_type = path_type; 1071 session->sample_rate = params_rate(params); 1072 session->channels = params_channels(params); 1073 1074 switch (params_format(params)) { 1075 case SNDRV_PCM_FORMAT_S16_LE: 1076 session->bits_per_sample = 16; 1077 break; 1078 case SNDRV_PCM_FORMAT_S24_LE: 1079 session->bits_per_sample = 24; 1080 break; 1081 default: 1082 break; 1083 } 1084 1085 mutex_unlock(&data->lock); 1086 return 0; 1087 } 1088 1089 static int msm_routing_probe(struct snd_soc_component *c) 1090 { 1091 int i; 1092 1093 for (i = 0; i < MAX_SESSIONS; i++) { 1094 routing_data->sessions[i].port_id = -1; 1095 routing_data->sessions[i].fedai_id = -1; 1096 } 1097 1098 return 0; 1099 } 1100 1101 static unsigned int q6routing_reg_read(struct snd_soc_component *component, 1102 unsigned int reg) 1103 { 1104 /* default value */ 1105 return 0; 1106 } 1107 1108 static int q6routing_reg_write(struct snd_soc_component *component, 1109 unsigned int reg, unsigned int val) 1110 { 1111 /* dummy */ 1112 return 0; 1113 } 1114 1115 static const struct snd_soc_component_driver msm_soc_routing_component = { 1116 .probe = msm_routing_probe, 1117 .name = DRV_NAME, 1118 .hw_params = routing_hw_params, 1119 .dapm_widgets = msm_qdsp6_widgets, 1120 .num_dapm_widgets = ARRAY_SIZE(msm_qdsp6_widgets), 1121 .dapm_routes = intercon, 1122 .num_dapm_routes = ARRAY_SIZE(intercon), 1123 .read = q6routing_reg_read, 1124 .write = q6routing_reg_write, 1125 }; 1126 1127 static int q6pcm_routing_probe(struct platform_device *pdev) 1128 { 1129 struct device *dev = &pdev->dev; 1130 1131 routing_data = kzalloc(sizeof(*routing_data), GFP_KERNEL); 1132 if (!routing_data) 1133 return -ENOMEM; 1134 1135 routing_data->dev = dev; 1136 1137 mutex_init(&routing_data->lock); 1138 dev_set_drvdata(dev, routing_data); 1139 1140 return devm_snd_soc_register_component(dev, &msm_soc_routing_component, 1141 NULL, 0); 1142 } 1143 1144 static void q6pcm_routing_remove(struct platform_device *pdev) 1145 { 1146 kfree(routing_data); 1147 routing_data = NULL; 1148 } 1149 1150 #ifdef CONFIG_OF 1151 static const struct of_device_id q6pcm_routing_device_id[] = { 1152 { .compatible = "qcom,q6adm-routing" }, 1153 {}, 1154 }; 1155 MODULE_DEVICE_TABLE(of, q6pcm_routing_device_id); 1156 #endif 1157 1158 static struct platform_driver q6pcm_routing_platform_driver = { 1159 .driver = { 1160 .name = "q6routing", 1161 .of_match_table = of_match_ptr(q6pcm_routing_device_id), 1162 }, 1163 .probe = q6pcm_routing_probe, 1164 .remove_new = q6pcm_routing_remove, 1165 }; 1166 module_platform_driver(q6pcm_routing_platform_driver); 1167 1168 MODULE_DESCRIPTION("Q6 Routing platform"); 1169 MODULE_LICENSE("GPL v2"); 1170