blob: 26fae75ebb251b53bffa61469f57377894c60f61 [file] [log] [blame]
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001/*
Aalique Grahame22e49102018-12-18 14:23:57 -08002 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
13 * * Neither the name of The Linux Foundation nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#define LOG_TAG "hardware_info"
31/*#define LOG_NDEBUG 0*/
32#define LOG_NDDEBUG 0
33
34#include <stdlib.h>
35#include <dlfcn.h>
Aalique Grahame22e49102018-12-18 14:23:57 -080036#include <log/log.h>
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070037#include <cutils/str_parms.h>
38#include "audio_hw.h"
39#include "platform.h"
40#include "platform_api.h"
41
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053042#ifdef DYNAMIC_LOG_ENABLED
43#include <log_xml_parser.h>
44#define LOG_MASK HAL_MOD_FILE_HW_INFO
45#include <log_utils.h>
46#endif
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070047
48struct hardware_info {
49 char name[HW_INFO_ARRAY_MAX_SIZE];
50 char type[HW_INFO_ARRAY_MAX_SIZE];
51 /* variables for handling target variants */
52 uint32_t num_snd_devices;
53 char dev_extn[HW_INFO_ARRAY_MAX_SIZE];
54 snd_device_t *snd_devices;
Sujin Panickerb904fbe2019-04-04 13:28:07 +053055 bool is_wsa_combo_suppported;
Rohit kumard3c3b912016-11-15 18:50:31 +053056 bool is_stereo_spkr;
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070057};
58
59#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
Sujin Panickerb904fbe2019-04-04 13:28:07 +053060#define WSA_MIXER_PATH_EXTENSION "wsa-"
61
62static const snd_device_t wsa_combo_devices[] = {
63 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
64 SND_DEVICE_OUT_SPEAKER_AND_LINE,
65 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
66 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
67 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET
68};
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070069
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070070static const snd_device_t taiko_fluid_variant_devices[] = {
71 SND_DEVICE_OUT_SPEAKER,
72 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
73 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
74};
75
76static const snd_device_t taiko_CDP_variant_devices[] = {
77 SND_DEVICE_OUT_SPEAKER,
78 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
79 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080080 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070081};
82
Banajit Goswamid60ca7f2013-11-16 20:55:49 -080083static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
84 SND_DEVICE_IN_HANDSET_MIC,
85};
86
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070087static const snd_device_t taiko_liquid_variant_devices[] = {
88 SND_DEVICE_OUT_SPEAKER,
89 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
90 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
91 SND_DEVICE_IN_SPEAKER_MIC,
92 SND_DEVICE_IN_HEADSET_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080093 SND_DEVICE_IN_VOICE_DMIC,
94 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
95 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
96 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
97 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -080098 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
99 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700100};
101
Mingming Yin0e1b2902014-05-19 18:20:59 -0700102static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = {
103 SND_DEVICE_IN_HANDSET_MIC,
104};
105
106static const snd_device_t tomtom_liquid_variant_devices[] = {
107 SND_DEVICE_OUT_SPEAKER,
Tanya Finkelb762e502014-07-10 08:03:01 -0700108 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
109 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700110 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
111 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
112 SND_DEVICE_IN_SPEAKER_MIC,
113 SND_DEVICE_IN_HEADSET_MIC,
114 SND_DEVICE_IN_VOICE_DMIC,
115 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
116 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
117 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
118 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800119 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
120 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700121};
122
123static const snd_device_t tomtom_stp_variant_devices[] = {
124 SND_DEVICE_OUT_SPEAKER,
125 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
126 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
127};
128
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700129static const snd_device_t taiko_DB_variant_devices[] = {
130 SND_DEVICE_OUT_SPEAKER,
131 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
132 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
133 SND_DEVICE_IN_SPEAKER_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800134 SND_DEVICE_IN_HEADSET_MIC,
135 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700136};
137
Tanya Finkelca735962014-11-05 23:17:25 +0200138static const snd_device_t tomtom_DB_variant_devices[] = {
139 SND_DEVICE_OUT_SPEAKER,
140 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
141 SND_DEVICE_OUT_SPEAKER_EXTERNAL_2,
142 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
143 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
144 SND_DEVICE_OUT_VOICE_SPEAKER,
145 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
146 SND_DEVICE_IN_HANDSET_MIC,
147 SND_DEVICE_IN_HANDSET_MIC_EXTERNAL
148};
149
Tanya Finkel2f96e842015-06-29 13:27:57 +0300150static const snd_device_t tasha_DB_variant_devices[] = {
151 SND_DEVICE_OUT_SPEAKER
152};
153
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300154static const snd_device_t tasha_sbc_variant_devices[] = {
155 SND_DEVICE_IN_HANDSET_MIC
156};
157
Tanya Finkel4594f752014-02-13 15:10:17 +0200158static const snd_device_t taiko_apq8084_sbc_variant_devices[] = {
159 SND_DEVICE_IN_HANDSET_MIC,
160 SND_DEVICE_IN_SPEAKER_MIC,
161};
162
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700163static const snd_device_t tapan_lite_variant_devices[] = {
164 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800165 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700166 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800167 SND_DEVICE_OUT_VOICE_HEADPHONES,
168 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
169 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700170};
171
172static const snd_device_t tapan_skuf_variant_devices[] = {
173 SND_DEVICE_OUT_SPEAKER,
174 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
175 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800176 /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700177};
178
179static const snd_device_t tapan_lite_skuf_variant_devices[] = {
180 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800181 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700182 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800183 SND_DEVICE_OUT_VOICE_HEADPHONES,
184 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
185 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700186};
187
188static const snd_device_t helicon_skuab_variant_devices[] = {
189 SND_DEVICE_OUT_SPEAKER,
190 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
191 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Walter Yang1d50ce62014-02-21 11:12:58 +0800192 SND_DEVICE_OUT_VOICE_SPEAKER,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700193};
194
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700195static const snd_device_t tasha_fluid_variant_devices[] = {
196 SND_DEVICE_OUT_SPEAKER,
197 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
198 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
199 SND_DEVICE_OUT_VOICE_SPEAKER,
200 SND_DEVICE_OUT_SPEAKER_AND_HDMI,
201 SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET,
202 SND_DEVICE_OUT_SPEAKER_PROTECTED,
203 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
204};
205
206static const snd_device_t tasha_liquid_variant_devices[] = {
207 SND_DEVICE_OUT_SPEAKER,
208 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
209 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
210 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
211 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
212 SND_DEVICE_IN_SPEAKER_MIC,
213 SND_DEVICE_IN_HEADSET_MIC,
214 SND_DEVICE_IN_VOICE_DMIC,
215 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
216 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
217 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
218 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800219 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
220 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700221};
222
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500223
Xiaoyu Ye11380482017-07-19 16:47:59 -0700224static const snd_device_t tavil_qrd_variant_devices[] = {
Karthikeyan Mani1e8a4b72017-08-24 11:05:50 -0700225 SND_DEVICE_OUT_SPEAKER,
226 SND_DEVICE_OUT_VOICE_SPEAKER,
227 SND_DEVICE_OUT_HANDSET,
228 SND_DEVICE_OUT_VOICE_HANDSET,
229 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Xiaoyu Ye11380482017-07-19 16:47:59 -0700230};
231
Meng Wang91affea2018-06-04 15:16:26 +0800232static const snd_device_t tavil_qrd_msmnile_variant_devices[] = {
233 SND_DEVICE_OUT_SPEAKER,
234 SND_DEVICE_OUT_VOICE_SPEAKER,
235 SND_DEVICE_OUT_HANDSET,
236 SND_DEVICE_OUT_VOICE_HANDSET,
237 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Yunfei Zhangf1bba382018-09-28 19:15:16 +0800238 SND_DEVICE_IN_VOICE_HEADSET_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800239 SND_DEVICE_IN_HANDSET_MIC,
240 SND_DEVICE_IN_HANDSET_MIC_AEC,
241 SND_DEVICE_IN_HANDSET_MIC_NS,
242 SND_DEVICE_IN_HANDSET_MIC_AEC_NS,
Meng Wang91affea2018-06-04 15:16:26 +0800243 SND_DEVICE_IN_SPEAKER_MIC,
kunleiz9644b272018-06-12 18:14:26 +0800244 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800245 SND_DEVICE_IN_SPEAKER_MIC_AEC,
246 SND_DEVICE_IN_SPEAKER_MIC_NS,
247 SND_DEVICE_IN_SPEAKER_MIC_AEC_NS,
kunleiz9644b272018-06-12 18:14:26 +0800248 SND_DEVICE_IN_VOICE_DMIC,
249 SND_DEVICE_IN_HANDSET_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800250 SND_DEVICE_IN_HANDSET_DMIC_NS,
251 SND_DEVICE_IN_HANDSET_DMIC_AEC,
252 SND_DEVICE_IN_HANDSET_DMIC_AEC_NS,
Aalique Grahame22e49102018-12-18 14:23:57 -0800253 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
254 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
kunleiz9644b272018-06-12 18:14:26 +0800255 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800256 SND_DEVICE_IN_SPEAKER_DMIC_AEC,
257 SND_DEVICE_IN_SPEAKER_DMIC_NS,
258 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS,
kunleiz4b4db4b2018-07-09 13:04:07 +0800259 SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
260 SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
261 SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
262 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
kunleiz9644b272018-06-12 18:14:26 +0800263 SND_DEVICE_IN_THREE_MIC,
264 SND_DEVICE_IN_HANDSET_TMIC,
265 SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO,
266 SND_DEVICE_IN_HANDSET_TMIC_AEC,
267 SND_DEVICE_IN_HANDSET_TMIC_NS,
268 SND_DEVICE_IN_HANDSET_TMIC_AEC_NS,
269 SND_DEVICE_IN_VOICE_SPEAKER_TMIC,
270 SND_DEVICE_IN_SPEAKER_TMIC_AEC,
271 SND_DEVICE_IN_SPEAKER_TMIC_NS,
272 SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS,
273 SND_DEVICE_IN_QUAD_MIC,
274 SND_DEVICE_IN_HANDSET_QMIC,
275 SND_DEVICE_IN_SPEAKER_QMIC_AEC,
276 SND_DEVICE_IN_SPEAKER_QMIC_NS,
277 SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
278 SND_DEVICE_IN_VOICE_SPEAKER_QMIC,
279 SND_DEVICE_IN_AANC_HANDSET_MIC,
280 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
281 SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
Xiaojun Sangfa1db6f2018-07-10 16:35:23 +0800282 SND_DEVICE_OUT_SPEAKER_PROTECTED,
283 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
284 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED,
Meng Wang91affea2018-06-04 15:16:26 +0800285};
286
287
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500288static const snd_device_t auto_variant_devices[] = {
289 SND_DEVICE_OUT_SPEAKER
290};
291
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700292static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name)
293{
Helen Zeng6a16ad72014-02-23 22:04:44 -0800294 if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card") ||
295 !strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card",
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800296 sizeof("apq8084-taiko-i2s-mtp-snd-card")) ||
297 !strncmp(snd_card_name, "apq8084-tomtom-mtp-snd-card",
298 sizeof("apq8084-tomtom-mtp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700299 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
300 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
301 hw_info->snd_devices = NULL;
302 hw_info->num_snd_devices = 0;
303 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800304 } else if ((!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) ||
305 !strncmp(snd_card_name, "apq8084-tomtom-cdp-snd-card",
306 sizeof("apq8084-tomtom-cdp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700307 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
308 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800309 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_CDP_variant_devices;
310 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_CDP_variant_devices);
311 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Helen Zeng6a16ad72014-02-23 22:04:44 -0800312 } else if (!strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card",
313 sizeof("apq8084-taiko-i2s-cdp-snd-card"))) {
314 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
315 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
316 hw_info->snd_devices = NULL;
317 hw_info->num_snd_devices = 0;
318 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700319 } else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) {
320 strlcpy(hw_info->type , " liquid", sizeof(hw_info->type));
321 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type));
322 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
323 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800324 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel4594f752014-02-13 15:10:17 +0200325 } else if (!strcmp(snd_card_name, "apq8084-taiko-sbc-snd-card")) {
326 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
327 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
328 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_sbc_variant_devices;
329 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_sbc_variant_devices);
330 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700331 } else {
332 ALOGW("%s: Not an 8084 device", __func__);
333 }
334}
335
Josh Kirschc3894372016-03-28 15:59:48 -0700336static void update_hardware_info_8096(struct hardware_info *hw_info, const char *snd_card_name)
337{
338 if (!strcmp(snd_card_name, "apq8096-tasha-i2c-snd-card")) {
339 ALOGW("%s: Updating hardware info for APQ 8096", __func__);
340 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
341 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
342 hw_info->snd_devices = NULL;
343 hw_info->num_snd_devices = 0;
344 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500345 } else if (!strcmp(snd_card_name, "apq8096-auto-snd-card")) {
346 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
347 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
348 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
349 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
350 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
351 } else if (!strcmp(snd_card_name, "apq8096-adp-agave-snd-card")) {
352 strlcpy(hw_info->type, " agave", sizeof(hw_info->type));
353 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
354 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
355 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
356 strlcpy(hw_info->dev_extn, "-agave", sizeof(hw_info->dev_extn));
357 } else if (!strcmp(snd_card_name, "apq8096-adp-mmxf-snd-card")) {
358 strlcpy(hw_info->type, " mmxf", sizeof(hw_info->type));
359 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
360 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
361 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
362 strlcpy(hw_info->dev_extn, "-mmxf", sizeof(hw_info->dev_extn));
Josh Kirschc3894372016-03-28 15:59:48 -0700363 } else {
364 ALOGW("%s: Not an 8096 device", __func__);
365 }
366}
367
Mingming Yin0e1b2902014-05-19 18:20:59 -0700368static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name)
369{
370 if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) {
371 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
372 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
373 hw_info->snd_devices = NULL;
374 hw_info->num_snd_devices = 0;
375 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700376 } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700377 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
378 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
379 hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
380 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
381 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700382 } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700383 strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
384 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
385 hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
386 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
387 strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700388 } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700389 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
390 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
391 hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
392 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices);
393 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkelca735962014-11-05 23:17:25 +0200394 } else if (!strcmp(snd_card_name, "msm8994-tomtom-db-snd-card")) {
395 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
396 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
397 hw_info->snd_devices = (snd_device_t *)tomtom_DB_variant_devices;
398 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_DB_variant_devices);
399 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Mingming Yin0e1b2902014-05-19 18:20:59 -0700400 } else {
401 ALOGW("%s: Not an 8994 device", __func__);
402 }
403}
404
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700405static void update_hardware_info_8996(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami22582e72014-10-15 18:29:34 -0700406{
Neema Shetty52a72c72015-08-26 12:26:06 -0700407 if (!strcmp(snd_card_name, "msm8996-tasha-fluid-snd-card")) {
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700408 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
409 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
410 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
411 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
412 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
413 } else if (!strcmp(snd_card_name, "msm8996-tasha-liquid-snd-card")) {
414 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
415 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
416 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
417 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
418 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel2f96e842015-06-29 13:27:57 +0300419 } else if (!strcmp(snd_card_name, "msm8996-tasha-db-snd-card")) {
420 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
421 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
422 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
423 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
424 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300425 } else if (!strcmp(snd_card_name, "msm8996-tasha-sbc-snd-card")) {
426 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
427 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
428 hw_info->snd_devices = (snd_device_t *)tasha_sbc_variant_devices;
429 hw_info->num_snd_devices = ARRAY_SIZE(tasha_sbc_variant_devices);
430 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Banajit Goswami22582e72014-10-15 18:29:34 -0700431 } else {
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700432 ALOGW("%s: Not a 8996 device", __func__);
Banajit Goswami22582e72014-10-15 18:29:34 -0700433 }
434}
435
Ben Romberger22d41232016-11-16 14:55:25 -0800436static void update_hardware_info_msm8998(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800437{
Ben Romberger22d41232016-11-16 14:55:25 -0800438 if (!strcmp(snd_card_name, "msm8998-tasha-fluid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800439 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800440 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800441 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
442 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
Rohit kumard3c3b912016-11-15 18:50:31 +0530443 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800444 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800445 } else if (!strcmp(snd_card_name, "msm8998-tasha-liquid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800446 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800447 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800448 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
449 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
450 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800451 } else if (!strcmp(snd_card_name, "msm8998-tasha-db-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800452 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800453 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800454 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
455 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
456 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
kunleizaa6a3f12017-01-19 12:28:28 +0800457 } else if (!strcmp(snd_card_name, "msm8998-qvr-tavil-snd-card")) {
458 hw_info->is_stereo_spkr = false;
459 } else if (!strcmp(snd_card_name, "msm8998-skuk-tavil-snd-card")) {
460 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800461 } else {
Ben Romberger22d41232016-11-16 14:55:25 -0800462 ALOGW("%s: Not a msm8998 device", __func__);
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800463 }
464}
465
Xiaoyu Ye11380482017-07-19 16:47:59 -0700466static void update_hardware_info_sdm845(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700467{
Xiaoyu Ye11380482017-07-19 16:47:59 -0700468 if (!strcmp(snd_card_name, "sdm845-tavil-qrd-snd-card")) {
469 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
470 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
471 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
472 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
473 hw_info->is_stereo_spkr = false;
474 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Meng Wang69b865c2017-10-30 15:12:12 +0800475 } else if (!strcmp(snd_card_name, "sdm845-tavil-hdk-snd-card")) {
476 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
477 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
478 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
479 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
480 hw_info->is_stereo_spkr = false;
481 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Meng Wang43a5e102017-11-01 10:49:01 +0800482 } else if (!strcmp(snd_card_name, "sdm845-qvr-tavil-snd-card")) {
483 hw_info->is_stereo_spkr = false;
Xiaoyu Ye11380482017-07-19 16:47:59 -0700484 } else {
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700485 ALOGW("%s: Not a sdm845 device", __func__);
Xiaoyu Ye11380482017-07-19 16:47:59 -0700486 }
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700487}
488
Meng Wang8e5dccc2018-03-05 15:52:24 +0800489static void update_hardware_info_msmnile(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800490{
Meng Wang8e5dccc2018-03-05 15:52:24 +0800491 if (strstr(snd_card_name, "qrd")) {
492 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
493 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
Meng Wang91affea2018-06-04 15:16:26 +0800494 hw_info->snd_devices = (snd_device_t *)tavil_qrd_msmnile_variant_devices;
495 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_msmnile_variant_devices);
Meng Wang8e5dccc2018-03-05 15:52:24 +0800496 hw_info->is_stereo_spkr = false;
497 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Vidyakumar Athota460cc662018-04-01 21:05:57 -0700498 } else if (strstr(snd_card_name, "pahu")) {
499 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
500 hw_info->is_stereo_spkr = false;
Derek Chen4d6f7702018-07-07 14:04:27 -0700501 } else if (strstr(snd_card_name, "adp")) {
502 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
503 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
504 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
505 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
506 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
507 } else if (strstr(snd_card_name, "custom")) {
508 strlcpy(hw_info->type, "custom", sizeof(hw_info->type));
509 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
510 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
511 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
512 strlcpy(hw_info->dev_extn, "-custom", sizeof(hw_info->dev_extn));
Meng Wang8e5dccc2018-03-05 15:52:24 +0800513 } else {
514 ALOGW("%s: Not a msmnile device", __func__);
515 }
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800516}
517
Meng Wangef2f6e12018-10-08 13:06:05 +0800518static void update_hardware_info_kona(
519 struct hardware_info *hw_info,
520 const char *snd_card_name)
521{
522 if (!strncmp(snd_card_name, "kona-mtp-snd-card",
523 sizeof("kona-mtp-snd-card"))) {
524 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
Vatsal Bucha6339b092019-04-17 16:27:32 +0530525 } else if (!strncmp(snd_card_name, "lito-mtp-snd-card",
526 sizeof("lito-mtp-snd-card"))) {
527 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530528 } else if (!strncmp(snd_card_name, "atoll-idp-snd-card",
529 sizeof("atoll-idp-snd-card"))) {
530 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
531 } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card",
532 sizeof("atoll-wcd937x-snd-card"))) {
533 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
Meng Wangef2f6e12018-10-08 13:06:05 +0800534 } else if (!strncmp(snd_card_name, "kona-qrd-snd-card",
535 sizeof("kona-qrd-snd-card"))) {
536 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
537 hw_info->is_stereo_spkr = false;
Vatsal Bucha6339b092019-04-17 16:27:32 +0530538 } else if (!strncmp(snd_card_name, "lito-qrd-snd-card",
539 sizeof("lito-qrd-snd-card"))) {
540 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
541 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800542 } else {
543 ALOGW("%s: Not a kona device", __func__);
544 }
545}
546
Josh Kirschf20adbf2018-03-06 16:26:22 -0800547static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name)
548{
549 if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) {
550 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
551 strlcpy(hw_info->name, "sda845", sizeof(hw_info->name));
552 hw_info->snd_devices = NULL;
553 hw_info->num_snd_devices = 0;
554 hw_info->is_stereo_spkr = false;
555 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
556 } else {
557 ALOGW("%s: Not a sda845 device", __func__);
558 }
559}
560
Xiaoyu Yec494c752017-11-02 18:52:48 -0700561static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused)
562{
563 ALOGW("%s: Not a sdx device", __func__);
564}
565
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700566static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
567{
568 if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
569 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
570 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
571 hw_info->snd_devices = NULL;
572 hw_info->num_snd_devices = 0;
573 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
574 } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
575 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
576 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
577 hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
578 hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800579 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700580 } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
581 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
582 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
583 hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
584 hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
585 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
586 } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
587 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
588 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
589 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
590 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
591 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
592 } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
593 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
594 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
595 hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
596 hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
597 strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
598 } else {
599 ALOGW("%s: Not an 8974 device", __func__);
600 }
601}
602
603static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
604{
605 if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
606 strlcpy(hw_info->type, "", sizeof(hw_info->type));
607 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
608 hw_info->snd_devices = NULL;
609 hw_info->num_snd_devices = 0;
610 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
611 } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
612 strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
613 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
614 hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
615 hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
616 strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
617 } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
618 strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
619 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
620 hw_info->snd_devices = NULL;
621 hw_info->num_snd_devices = 0;
622 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
623 } else {
624 ALOGW("%s: Not an 8x10 device", __func__);
625 }
626}
627
628static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
629{
630 if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
631 strlcpy(hw_info->type, "", sizeof(hw_info->type));
632 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
633 hw_info->snd_devices = NULL;
634 hw_info->num_snd_devices = 0;
635 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
636 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
637 strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
638 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
639 hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
640 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
641 strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
642 } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
643 strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
644 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
645 hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
646 hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
647 strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
648 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
649 strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
650 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
651 hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
652 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
653 strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
654 } else {
655 ALOGW("%s: Not an 8x26 device", __func__);
656 }
657}
658
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530659static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name)
660{
Walter Yang319c6fe2017-09-21 17:09:39 +0800661 if (!strncmp(snd_card_name, "sdm660-snd-card",
Meng Wang923204f2018-05-21 18:32:41 +0800662 sizeof("sdm660-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530663 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530664 } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) {
665 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
666 } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) {
667 hw_info->is_stereo_spkr = false;
668 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
669 } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) {
670 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800671 } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card",
672 sizeof("qcs405-sku1-snd-card"))) {
Dhananjay Kumar75c9a0c2018-06-07 15:59:00 +0530673 strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800674 } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card",
675 sizeof("qcs605-lc-snd-card"))) {
Sachin Mohan Gadageffd7562018-02-13 17:10:09 +0530676 strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name));
yang liu9f4232d2018-09-18 20:51:11 +0800677 } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card",
678 sizeof("qcs605-ipc-tavil-snd-card"))) {
679 strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800680 } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card",
681 sizeof("sdm660-tavil-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530682 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800683 } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card",
684 sizeof("sdm670-skuw-snd-card"))) {
Walter Yang319c6fe2017-09-21 17:09:39 +0800685 hw_info->is_stereo_spkr = false;
Meng Wang923204f2018-05-21 18:32:41 +0800686 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
687 sizeof("sdm670-tavil-hdk-snd-card"))) {
688 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
689 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
690 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
691 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
692 hw_info->is_stereo_spkr = false;
693 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530694 } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card",
695 sizeof("sm6150-idp-snd-card"))) {
696 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Aditya Bavanari4dbceed2018-10-11 18:31:55 +0530697 } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card",
698 sizeof("sm6150-wcd9375-snd-card"))) {
699 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Xiaojun Sangfcddd672018-08-15 17:53:48 +0800700 } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card",
701 sizeof("sm6150-qrd-snd-card"))) {
702 hw_info->is_stereo_spkr = false;
703 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
kunleiz3ae92e52019-04-28 15:35:31 +0800704 } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card",
705 sizeof("sm6150-wcd9375qrd-snd-card"))) {
706 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
707 hw_info->is_stereo_spkr = false;
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530708 } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card",
709 sizeof("sm6150-tavil-snd-card"))) {
710 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530711 hw_info->is_stereo_spkr = false;
712 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
713 sizeof("sdm670-tavil-hdk-snd-card"))) {
714 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
715 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
716 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
717 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
718 hw_info->is_stereo_spkr = false;
719 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530720 } else if (!strncmp(snd_card_name, "trinket-idp-snd-card",
721 sizeof("trinket-idp-snd-card"))) {
722 hw_info->is_stereo_spkr = false;
723 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
724 } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card",
725 sizeof("trinket-tashalite-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530726 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
727 } else if (!strncmp(snd_card_name, "trinket-tasha-snd-card",
728 sizeof("trinket-tasha-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530729 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
730 } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card",
731 sizeof("trinket-tavil-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530732 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530733 } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card",
734 sizeof("sa6155-adp-star-snd-card"))) {
735 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
736 strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name));
737 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
738 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
739 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
Meng Wang923204f2018-05-21 18:32:41 +0800740 } else {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530741 ALOGW("%s: Not an SDM device", __func__);
Meng Wang923204f2018-05-21 18:32:41 +0800742 }
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530743}
744
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530745static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name)
746{
747 if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
748 hw_info->is_stereo_spkr = false;
749 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
750 } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
751 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
752 } else {
753 ALOGW("%s: Not an SDM439 device", __func__);
754 }
755}
756
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700757void *hw_info_init(const char *snd_card_name)
758{
759 struct hardware_info *hw_info;
760
761 hw_info = malloc(sizeof(struct hardware_info));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700762 if (!hw_info) {
763 ALOGE("failed to allocate mem for hardware info");
764 return NULL;
765 }
766
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800767 hw_info->snd_devices = NULL;
768 hw_info->num_snd_devices = 0;
Rohit kumard3c3b912016-11-15 18:50:31 +0530769 hw_info->is_stereo_spkr = true;
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530770 hw_info->is_wsa_combo_suppported = false;
Mingming Yin0e1b2902014-05-19 18:20:59 -0700771 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
772 strlcpy(hw_info->type, "", sizeof(hw_info->type));
773 strlcpy(hw_info->name, "", sizeof(hw_info->name));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700774
775 if(strstr(snd_card_name, "msm8974") ||
776 strstr(snd_card_name, "apq8074")) {
777 ALOGV("8974 - variant soundcard");
778 update_hardware_info_8974(hw_info, snd_card_name);
779 } else if(strstr(snd_card_name, "msm8226")) {
780 ALOGV("8x26 - variant soundcard");
781 update_hardware_info_8226(hw_info, snd_card_name);
782 } else if(strstr(snd_card_name, "msm8x10")) {
783 ALOGV("8x10 - variant soundcard");
784 update_hardware_info_8610(hw_info, snd_card_name);
785 } else if(strstr(snd_card_name, "apq8084")) {
786 ALOGV("8084 - variant soundcard");
787 update_hardware_info_8084(hw_info, snd_card_name);
Mingming Yin0e1b2902014-05-19 18:20:59 -0700788 } else if(strstr(snd_card_name, "msm8994")) {
789 ALOGV("8994 - variant soundcard");
790 update_hardware_info_8994(hw_info, snd_card_name);
Josh Kirschc3894372016-03-28 15:59:48 -0700791 } else if(strstr(snd_card_name, "apq8096")) {
792 ALOGV("8096 - variant soundcard");
793 update_hardware_info_8096(hw_info, snd_card_name);
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700794 } else if(strstr(snd_card_name, "msm8996")) {
795 ALOGV("8996 - variant soundcard");
796 update_hardware_info_8996(hw_info, snd_card_name);
Venkataraman Nerellapallib8689ec2017-05-04 11:55:29 +0530797 } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) {
Ben Romberger22d41232016-11-16 14:55:25 -0800798 ALOGV("MSM8998 - variant soundcard");
799 update_hardware_info_msm8998(hw_info, snd_card_name);
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700800 } else if(strstr(snd_card_name, "sdm845")) {
801 ALOGV("SDM845 - variant soundcard");
802 update_hardware_info_sdm845(hw_info, snd_card_name);
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530803 } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670")
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530804 || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc")
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530805 || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc")
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530806 || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530807 ALOGV("Bear - variant soundcard");
808 update_hardware_info_bear(hw_info, snd_card_name);
Walter Yang558e1132018-01-02 11:47:19 +0800809 } else if (strstr(snd_card_name, "sdx")) {
Xiaoyu Yec494c752017-11-02 18:52:48 -0700810 ALOGV("SDX - variant soundcard");
811 update_hardware_info_sdx(hw_info, snd_card_name);
Derek Chen4d6f7702018-07-07 14:04:27 -0700812 } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") ||
813 strstr(snd_card_name, "sa8155")) {
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800814 ALOGV("MSMNILE - variant soundcard");
815 update_hardware_info_msmnile(hw_info, snd_card_name);
Josh Kirschf20adbf2018-03-06 16:26:22 -0800816 } else if (strstr(snd_card_name, "sda845")) {
817 ALOGV("SDA845 - variant soundcard");
818 update_hardware_info_sda845(hw_info, snd_card_name);
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530819 } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito")
820 || strstr(snd_card_name, "atoll")) {
Meng Wangef2f6e12018-10-08 13:06:05 +0800821 ALOGV("KONA - variant soundcard");
822 update_hardware_info_kona(hw_info, snd_card_name);
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530823 } else if(strstr(snd_card_name, "sdm439")) {
824 ALOGV("SDM439 - variant soundcard");
825 update_hardware_info_sdm439(hw_info, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700826 } else {
Mingming Yin834543b2013-12-30 15:52:43 -0800827 ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700828 free(hw_info);
829 hw_info = NULL;
830 }
831
832 return hw_info;
833}
834
835void hw_info_deinit(void *hw_info)
836{
837 struct hardware_info *my_data = (struct hardware_info*) hw_info;
838
839 if(!my_data)
840 free(my_data);
841}
842
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530843void hw_info_enable_wsa_combo_usecase_support(void *hw_info)
844{
845 struct hardware_info *my_data = (struct hardware_info*) hw_info;
846 if(!my_data) {
847 ALOGE(" ERROR wsa combo update is called with invalid hw_info");
848 return;
849 }
850 my_data->is_wsa_combo_suppported = true;
851
852}
853
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700854void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
855 char *device_name)
856{
857 struct hardware_info *my_data = (struct hardware_info*) hw_info;
858 uint32_t i = 0;
859
860 snd_device_t *snd_devices =
861 (snd_device_t *) my_data->snd_devices;
862
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530863
864 if(my_data->is_wsa_combo_suppported) {
865 for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) {
866 if (snd_device == (snd_device_t)wsa_combo_devices[i]) {
867 char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0};
868 ALOGD("appending wsa extension to device %s",
869 device_name);
870 strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION,
871 sizeof(WSA_MIXER_PATH_EXTENSION)) ;
872 strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE);
873 strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1);
874 break;
875 }
876 }
877 }
878
879
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700880 if(snd_devices != NULL) {
881 for (i = 0; i < my_data->num_snd_devices; i++) {
882 if (snd_device == (snd_device_t)snd_devices[i]) {
883 ALOGV("extract dev_extn device %d, extn = %s",
884 (snd_device_t)snd_devices[i], my_data->dev_extn);
885 CHECK(strlcat(device_name, my_data->dev_extn,
886 DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
887 break;
888 }
889 }
890 }
891 ALOGD("%s : device_name = %s", __func__,device_name);
892}
Rohit kumard3c3b912016-11-15 18:50:31 +0530893
894bool hw_info_is_stereo_spkr(void *hw_info)
895{
896 struct hardware_info *my_data = (struct hardware_info*) hw_info;
897
898 return my_data->is_stereo_spkr;
899}