blob: 04b3245727ce04be105171e30462633a3d4a4aca [file] [log] [blame]
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001/*
Sujin Panickerd53dd1b2019-12-23 18:56:54 +05302 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07003 *
Meng Wangf8cf3fe2020-09-23 16:34:36 +08004 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
5 *
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07006 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials provided
14 * with the distribution.
15 * * Neither the name of The Linux Foundation nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
29 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#define LOG_TAG "hardware_info"
33/*#define LOG_NDEBUG 0*/
34#define LOG_NDDEBUG 0
35
36#include <stdlib.h>
37#include <dlfcn.h>
Aalique Grahame22e49102018-12-18 14:23:57 -080038#include <log/log.h>
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070039#include <cutils/str_parms.h>
40#include "audio_hw.h"
41#include "platform.h"
42#include "platform_api.h"
43
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053044#ifdef DYNAMIC_LOG_ENABLED
45#include <log_xml_parser.h>
46#define LOG_MASK HAL_MOD_FILE_HW_INFO
47#include <log_utils.h>
48#endif
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070049
50struct hardware_info {
51 char name[HW_INFO_ARRAY_MAX_SIZE];
52 char type[HW_INFO_ARRAY_MAX_SIZE];
53 /* variables for handling target variants */
54 uint32_t num_snd_devices;
55 char dev_extn[HW_INFO_ARRAY_MAX_SIZE];
56 snd_device_t *snd_devices;
Sujin Panickerb904fbe2019-04-04 13:28:07 +053057 bool is_wsa_combo_suppported;
Rohit kumard3c3b912016-11-15 18:50:31 +053058 bool is_stereo_spkr;
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070059};
60
61#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
Sujin Panickerb904fbe2019-04-04 13:28:07 +053062#define WSA_MIXER_PATH_EXTENSION "wsa-"
63
64static const snd_device_t wsa_combo_devices[] = {
65 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
66 SND_DEVICE_OUT_SPEAKER_AND_LINE,
67 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
68 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
Ramlal Karraab51d042019-08-08 19:02:35 +053069 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
70 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_HIFI_FILTER
Sujin Panickerb904fbe2019-04-04 13:28:07 +053071};
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070072
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070073static const snd_device_t taiko_fluid_variant_devices[] = {
74 SND_DEVICE_OUT_SPEAKER,
75 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
76 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
77};
78
79static const snd_device_t taiko_CDP_variant_devices[] = {
80 SND_DEVICE_OUT_SPEAKER,
81 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
82 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080083 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070084};
85
Banajit Goswamid60ca7f2013-11-16 20:55:49 -080086static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
87 SND_DEVICE_IN_HANDSET_MIC,
88};
89
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070090static const snd_device_t taiko_liquid_variant_devices[] = {
91 SND_DEVICE_OUT_SPEAKER,
92 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
93 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
94 SND_DEVICE_IN_SPEAKER_MIC,
95 SND_DEVICE_IN_HEADSET_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080096 SND_DEVICE_IN_VOICE_DMIC,
97 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
98 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
99 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
100 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800101 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
102 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700103};
104
Mingming Yin0e1b2902014-05-19 18:20:59 -0700105static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = {
106 SND_DEVICE_IN_HANDSET_MIC,
107};
108
109static const snd_device_t tomtom_liquid_variant_devices[] = {
110 SND_DEVICE_OUT_SPEAKER,
Tanya Finkelb762e502014-07-10 08:03:01 -0700111 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
112 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700113 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
114 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
115 SND_DEVICE_IN_SPEAKER_MIC,
116 SND_DEVICE_IN_HEADSET_MIC,
117 SND_DEVICE_IN_VOICE_DMIC,
118 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
119 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
120 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
121 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800122 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
123 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700124};
125
126static const snd_device_t tomtom_stp_variant_devices[] = {
127 SND_DEVICE_OUT_SPEAKER,
128 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
129 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
130};
131
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700132static const snd_device_t taiko_DB_variant_devices[] = {
133 SND_DEVICE_OUT_SPEAKER,
134 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
135 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
136 SND_DEVICE_IN_SPEAKER_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800137 SND_DEVICE_IN_HEADSET_MIC,
138 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700139};
140
Tanya Finkelca735962014-11-05 23:17:25 +0200141static const snd_device_t tomtom_DB_variant_devices[] = {
142 SND_DEVICE_OUT_SPEAKER,
143 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
144 SND_DEVICE_OUT_SPEAKER_EXTERNAL_2,
145 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
146 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
147 SND_DEVICE_OUT_VOICE_SPEAKER,
148 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
149 SND_DEVICE_IN_HANDSET_MIC,
150 SND_DEVICE_IN_HANDSET_MIC_EXTERNAL
151};
152
Tanya Finkel2f96e842015-06-29 13:27:57 +0300153static const snd_device_t tasha_DB_variant_devices[] = {
154 SND_DEVICE_OUT_SPEAKER
155};
156
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300157static const snd_device_t tasha_sbc_variant_devices[] = {
158 SND_DEVICE_IN_HANDSET_MIC
159};
160
Tanya Finkel4594f752014-02-13 15:10:17 +0200161static const snd_device_t taiko_apq8084_sbc_variant_devices[] = {
162 SND_DEVICE_IN_HANDSET_MIC,
163 SND_DEVICE_IN_SPEAKER_MIC,
164};
165
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700166static const snd_device_t tapan_lite_variant_devices[] = {
167 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800168 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700169 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800170 SND_DEVICE_OUT_VOICE_HEADPHONES,
171 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
172 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700173};
174
175static const snd_device_t tapan_skuf_variant_devices[] = {
176 SND_DEVICE_OUT_SPEAKER,
177 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
178 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800179 /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700180};
181
182static const snd_device_t tapan_lite_skuf_variant_devices[] = {
183 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800184 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700185 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800186 SND_DEVICE_OUT_VOICE_HEADPHONES,
187 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
188 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700189};
190
191static const snd_device_t helicon_skuab_variant_devices[] = {
192 SND_DEVICE_OUT_SPEAKER,
193 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
194 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Walter Yang1d50ce62014-02-21 11:12:58 +0800195 SND_DEVICE_OUT_VOICE_SPEAKER,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700196};
197
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700198static const snd_device_t tasha_fluid_variant_devices[] = {
199 SND_DEVICE_OUT_SPEAKER,
200 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
201 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
202 SND_DEVICE_OUT_VOICE_SPEAKER,
203 SND_DEVICE_OUT_SPEAKER_AND_HDMI,
204 SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET,
205 SND_DEVICE_OUT_SPEAKER_PROTECTED,
206 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
207};
208
209static const snd_device_t tasha_liquid_variant_devices[] = {
210 SND_DEVICE_OUT_SPEAKER,
211 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
212 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
213 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
214 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
215 SND_DEVICE_IN_SPEAKER_MIC,
216 SND_DEVICE_IN_HEADSET_MIC,
217 SND_DEVICE_IN_VOICE_DMIC,
218 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
219 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
220 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
221 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800222 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
223 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700224};
225
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500226
Xiaoyu Ye11380482017-07-19 16:47:59 -0700227static const snd_device_t tavil_qrd_variant_devices[] = {
Karthikeyan Mani1e8a4b72017-08-24 11:05:50 -0700228 SND_DEVICE_OUT_SPEAKER,
229 SND_DEVICE_OUT_VOICE_SPEAKER,
230 SND_DEVICE_OUT_HANDSET,
231 SND_DEVICE_OUT_VOICE_HANDSET,
232 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Xiaoyu Ye11380482017-07-19 16:47:59 -0700233};
234
Meng Wang91affea2018-06-04 15:16:26 +0800235static const snd_device_t tavil_qrd_msmnile_variant_devices[] = {
236 SND_DEVICE_OUT_SPEAKER,
237 SND_DEVICE_OUT_VOICE_SPEAKER,
238 SND_DEVICE_OUT_HANDSET,
239 SND_DEVICE_OUT_VOICE_HANDSET,
240 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Yunfei Zhangf1bba382018-09-28 19:15:16 +0800241 SND_DEVICE_IN_VOICE_HEADSET_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800242 SND_DEVICE_IN_HANDSET_MIC,
243 SND_DEVICE_IN_HANDSET_MIC_AEC,
244 SND_DEVICE_IN_HANDSET_MIC_NS,
245 SND_DEVICE_IN_HANDSET_MIC_AEC_NS,
Meng Wang91affea2018-06-04 15:16:26 +0800246 SND_DEVICE_IN_SPEAKER_MIC,
kunleiz9644b272018-06-12 18:14:26 +0800247 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800248 SND_DEVICE_IN_SPEAKER_MIC_AEC,
249 SND_DEVICE_IN_SPEAKER_MIC_NS,
250 SND_DEVICE_IN_SPEAKER_MIC_AEC_NS,
kunleiz9644b272018-06-12 18:14:26 +0800251 SND_DEVICE_IN_VOICE_DMIC,
252 SND_DEVICE_IN_HANDSET_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800253 SND_DEVICE_IN_HANDSET_DMIC_NS,
254 SND_DEVICE_IN_HANDSET_DMIC_AEC,
255 SND_DEVICE_IN_HANDSET_DMIC_AEC_NS,
Aalique Grahame22e49102018-12-18 14:23:57 -0800256 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
257 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
kunleiz9644b272018-06-12 18:14:26 +0800258 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800259 SND_DEVICE_IN_SPEAKER_DMIC_AEC,
260 SND_DEVICE_IN_SPEAKER_DMIC_NS,
261 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS,
kunleiz4b4db4b2018-07-09 13:04:07 +0800262 SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
263 SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
264 SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
265 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
kunleiz9644b272018-06-12 18:14:26 +0800266 SND_DEVICE_IN_THREE_MIC,
267 SND_DEVICE_IN_HANDSET_TMIC,
268 SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO,
269 SND_DEVICE_IN_HANDSET_TMIC_AEC,
270 SND_DEVICE_IN_HANDSET_TMIC_NS,
271 SND_DEVICE_IN_HANDSET_TMIC_AEC_NS,
272 SND_DEVICE_IN_VOICE_SPEAKER_TMIC,
273 SND_DEVICE_IN_SPEAKER_TMIC_AEC,
274 SND_DEVICE_IN_SPEAKER_TMIC_NS,
275 SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS,
276 SND_DEVICE_IN_QUAD_MIC,
277 SND_DEVICE_IN_HANDSET_QMIC,
278 SND_DEVICE_IN_SPEAKER_QMIC_AEC,
279 SND_DEVICE_IN_SPEAKER_QMIC_NS,
280 SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
281 SND_DEVICE_IN_VOICE_SPEAKER_QMIC,
282 SND_DEVICE_IN_AANC_HANDSET_MIC,
283 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
284 SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
Xiaojun Sangfa1db6f2018-07-10 16:35:23 +0800285 SND_DEVICE_OUT_SPEAKER_PROTECTED,
286 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
287 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED,
Meng Wang91affea2018-06-04 15:16:26 +0800288};
289
290
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500291static const snd_device_t auto_variant_devices[] = {
292 SND_DEVICE_OUT_SPEAKER
293};
294
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700295static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name)
296{
Helen Zeng6a16ad72014-02-23 22:04:44 -0800297 if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card") ||
298 !strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card",
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800299 sizeof("apq8084-taiko-i2s-mtp-snd-card")) ||
300 !strncmp(snd_card_name, "apq8084-tomtom-mtp-snd-card",
301 sizeof("apq8084-tomtom-mtp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700302 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
303 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
304 hw_info->snd_devices = NULL;
305 hw_info->num_snd_devices = 0;
306 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800307 } else if ((!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) ||
308 !strncmp(snd_card_name, "apq8084-tomtom-cdp-snd-card",
309 sizeof("apq8084-tomtom-cdp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700310 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
311 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800312 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_CDP_variant_devices;
313 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_CDP_variant_devices);
314 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Helen Zeng6a16ad72014-02-23 22:04:44 -0800315 } else if (!strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card",
316 sizeof("apq8084-taiko-i2s-cdp-snd-card"))) {
317 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
318 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
319 hw_info->snd_devices = NULL;
320 hw_info->num_snd_devices = 0;
321 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700322 } else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) {
323 strlcpy(hw_info->type , " liquid", sizeof(hw_info->type));
324 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type));
325 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
326 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800327 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel4594f752014-02-13 15:10:17 +0200328 } else if (!strcmp(snd_card_name, "apq8084-taiko-sbc-snd-card")) {
329 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
330 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
331 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_sbc_variant_devices;
332 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_sbc_variant_devices);
333 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700334 } else {
335 ALOGW("%s: Not an 8084 device", __func__);
336 }
337}
338
Josh Kirschc3894372016-03-28 15:59:48 -0700339static void update_hardware_info_8096(struct hardware_info *hw_info, const char *snd_card_name)
340{
341 if (!strcmp(snd_card_name, "apq8096-tasha-i2c-snd-card")) {
342 ALOGW("%s: Updating hardware info for APQ 8096", __func__);
343 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
344 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
345 hw_info->snd_devices = NULL;
346 hw_info->num_snd_devices = 0;
347 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500348 } else if (!strcmp(snd_card_name, "apq8096-auto-snd-card")) {
349 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
350 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
351 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
352 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
353 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
354 } else if (!strcmp(snd_card_name, "apq8096-adp-agave-snd-card")) {
355 strlcpy(hw_info->type, " agave", sizeof(hw_info->type));
356 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
357 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
358 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
359 strlcpy(hw_info->dev_extn, "-agave", sizeof(hw_info->dev_extn));
360 } else if (!strcmp(snd_card_name, "apq8096-adp-mmxf-snd-card")) {
361 strlcpy(hw_info->type, " mmxf", sizeof(hw_info->type));
362 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
363 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
364 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
365 strlcpy(hw_info->dev_extn, "-mmxf", sizeof(hw_info->dev_extn));
Josh Kirschc3894372016-03-28 15:59:48 -0700366 } else {
367 ALOGW("%s: Not an 8096 device", __func__);
368 }
369}
370
Mingming Yin0e1b2902014-05-19 18:20:59 -0700371static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name)
372{
373 if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) {
374 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
375 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
376 hw_info->snd_devices = NULL;
377 hw_info->num_snd_devices = 0;
378 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700379 } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700380 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
381 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
382 hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
383 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
384 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700385 } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700386 strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
387 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
388 hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
389 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
390 strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700391 } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700392 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
393 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
394 hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
395 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices);
396 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkelca735962014-11-05 23:17:25 +0200397 } else if (!strcmp(snd_card_name, "msm8994-tomtom-db-snd-card")) {
398 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
399 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
400 hw_info->snd_devices = (snd_device_t *)tomtom_DB_variant_devices;
401 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_DB_variant_devices);
402 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Mingming Yin0e1b2902014-05-19 18:20:59 -0700403 } else {
404 ALOGW("%s: Not an 8994 device", __func__);
405 }
406}
407
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700408static void update_hardware_info_8996(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami22582e72014-10-15 18:29:34 -0700409{
Neema Shetty52a72c72015-08-26 12:26:06 -0700410 if (!strcmp(snd_card_name, "msm8996-tasha-fluid-snd-card")) {
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700411 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
412 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
413 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
414 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
415 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
416 } else if (!strcmp(snd_card_name, "msm8996-tasha-liquid-snd-card")) {
417 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
418 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
419 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
420 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
421 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel2f96e842015-06-29 13:27:57 +0300422 } else if (!strcmp(snd_card_name, "msm8996-tasha-db-snd-card")) {
423 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
424 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
425 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
426 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
427 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300428 } else if (!strcmp(snd_card_name, "msm8996-tasha-sbc-snd-card")) {
429 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
430 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
431 hw_info->snd_devices = (snd_device_t *)tasha_sbc_variant_devices;
432 hw_info->num_snd_devices = ARRAY_SIZE(tasha_sbc_variant_devices);
433 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Banajit Goswami22582e72014-10-15 18:29:34 -0700434 } else {
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700435 ALOGW("%s: Not a 8996 device", __func__);
Banajit Goswami22582e72014-10-15 18:29:34 -0700436 }
437}
438
Ben Romberger22d41232016-11-16 14:55:25 -0800439static void update_hardware_info_msm8998(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800440{
Ben Romberger22d41232016-11-16 14:55:25 -0800441 if (!strcmp(snd_card_name, "msm8998-tasha-fluid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800442 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800443 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800444 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
445 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
Rohit kumard3c3b912016-11-15 18:50:31 +0530446 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800447 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800448 } else if (!strcmp(snd_card_name, "msm8998-tasha-liquid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800449 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800450 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800451 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
452 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
453 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800454 } else if (!strcmp(snd_card_name, "msm8998-tasha-db-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800455 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800456 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800457 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
458 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
459 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
kunleizaa6a3f12017-01-19 12:28:28 +0800460 } else if (!strcmp(snd_card_name, "msm8998-qvr-tavil-snd-card")) {
461 hw_info->is_stereo_spkr = false;
462 } else if (!strcmp(snd_card_name, "msm8998-skuk-tavil-snd-card")) {
463 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800464 } else {
Ben Romberger22d41232016-11-16 14:55:25 -0800465 ALOGW("%s: Not a msm8998 device", __func__);
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800466 }
467}
468
Xiaoyu Ye11380482017-07-19 16:47:59 -0700469static void update_hardware_info_sdm845(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700470{
Xiaoyu Ye11380482017-07-19 16:47:59 -0700471 if (!strcmp(snd_card_name, "sdm845-tavil-qrd-snd-card")) {
472 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
473 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
474 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
475 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
476 hw_info->is_stereo_spkr = false;
477 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Meng Wang69b865c2017-10-30 15:12:12 +0800478 } else if (!strcmp(snd_card_name, "sdm845-tavil-hdk-snd-card")) {
479 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
480 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
481 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
482 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
483 hw_info->is_stereo_spkr = false;
484 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Meng Wang43a5e102017-11-01 10:49:01 +0800485 } else if (!strcmp(snd_card_name, "sdm845-qvr-tavil-snd-card")) {
486 hw_info->is_stereo_spkr = false;
Xiaoyu Ye11380482017-07-19 16:47:59 -0700487 } else {
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700488 ALOGW("%s: Not a sdm845 device", __func__);
Xiaoyu Ye11380482017-07-19 16:47:59 -0700489 }
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700490}
491
Meng Wang8e5dccc2018-03-05 15:52:24 +0800492static void update_hardware_info_msmnile(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800493{
Meng Wang8e5dccc2018-03-05 15:52:24 +0800494 if (strstr(snd_card_name, "qrd")) {
495 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
496 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
Meng Wang91affea2018-06-04 15:16:26 +0800497 hw_info->snd_devices = (snd_device_t *)tavil_qrd_msmnile_variant_devices;
498 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_msmnile_variant_devices);
Meng Wang8e5dccc2018-03-05 15:52:24 +0800499 hw_info->is_stereo_spkr = false;
500 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Vidyakumar Athota460cc662018-04-01 21:05:57 -0700501 } else if (strstr(snd_card_name, "pahu")) {
502 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
503 hw_info->is_stereo_spkr = false;
Derek Chen4d6f7702018-07-07 14:04:27 -0700504 } else if (strstr(snd_card_name, "adp")) {
505 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
506 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
507 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
508 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
509 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
510 } else if (strstr(snd_card_name, "custom")) {
511 strlcpy(hw_info->type, "custom", sizeof(hw_info->type));
512 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
513 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
514 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
515 strlcpy(hw_info->dev_extn, "-custom", sizeof(hw_info->dev_extn));
Meng Wang8e5dccc2018-03-05 15:52:24 +0800516 } else {
517 ALOGW("%s: Not a msmnile device", __func__);
518 }
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800519}
520
Meng Wangef2f6e12018-10-08 13:06:05 +0800521static void update_hardware_info_kona(
522 struct hardware_info *hw_info,
523 const char *snd_card_name)
524{
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800525 if (!strncmp(snd_card_name, "lito-lagoonmtp-snd-card",
526 sizeof("lito-lagoonmtp-snd-card"))) {
527 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
528 } else if (!strncmp(snd_card_name, "lito-lagoonqrd-snd-card",
529 sizeof("lito-lagoonqrd-snd-card"))) {
530 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
531 hw_info->is_stereo_spkr = false;
Subhadra Jagadeesanc6a85b82020-09-09 16:59:43 +0530532 } else if (!strncmp(snd_card_name, "lito-orchidmtp-snd-card",
533 sizeof("lito-orchidmtp-snd-card"))) {
534 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800535 } else if (!strncmp(snd_card_name, "bengal-idp-snd-card",
Harshal Ahire46374152019-10-22 11:37:12 +0530536 sizeof("bengal-idp-snd-card"))) {
537 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
538 hw_info->is_stereo_spkr = false;
Aditya Bavanari05999be2020-03-12 20:12:32 +0530539 } else if (!strncmp(snd_card_name, "bengal-scubaidp-snd-card",
540 sizeof("bengal-scubaidp-snd-card"))) {
541 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
542 hw_info->is_stereo_spkr = false;
Harshal Ahire46374152019-10-22 11:37:12 +0530543 } else if (!strncmp(snd_card_name, "kona-mtp-snd-card",
Meng Wangef2f6e12018-10-08 13:06:05 +0800544 sizeof("kona-mtp-snd-card"))) {
545 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
Vatsal Bucha6339b092019-04-17 16:27:32 +0530546 } else if (!strncmp(snd_card_name, "lito-mtp-snd-card",
547 sizeof("lito-mtp-snd-card"))) {
548 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530549 } else if (!strncmp(snd_card_name, "atoll-idp-snd-card",
550 sizeof("atoll-idp-snd-card"))) {
551 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
552 } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card",
553 sizeof("atoll-wcd937x-snd-card"))) {
554 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
Kunlei Zhang47509fc2019-08-16 16:41:28 +0800555 } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card",
556 sizeof("atoll-qrd-snd-card"))) {
557 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
558 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800559 } else if (!strncmp(snd_card_name, "kona-qrd-snd-card",
560 sizeof("kona-qrd-snd-card"))) {
561 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
562 hw_info->is_stereo_spkr = false;
Meng Wangf8cf3fe2020-09-23 16:34:36 +0800563 } else if (!strncmp(snd_card_name, "kona-xrfusion-ult-snd-card",
564 sizeof("kona-xrfusion-ult-snd-card"))) {
565 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
566 hw_info->is_stereo_spkr = true;
567 } else if (!strncmp(snd_card_name, "kona-xrfusionult-snd-card",
568 sizeof("kona-xrfusionult-snd-card"))) {
569 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
570 hw_info->is_stereo_spkr = true;
Vatsal Bucha6339b092019-04-17 16:27:32 +0530571 } else if (!strncmp(snd_card_name, "lito-qrd-snd-card",
572 sizeof("lito-qrd-snd-card"))) {
573 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
574 hw_info->is_stereo_spkr = false;
Kunlei Zhang57215122019-12-30 13:43:31 +0800575 } else if (!strncmp(snd_card_name, "bengal-qrd-snd-card",
576 sizeof("bengal-qrd-snd-card"))) {
577 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
578 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800579 } else {
580 ALOGW("%s: Not a kona device", __func__);
581 }
582}
583
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530584static void update_hardware_info_holi(
585 struct hardware_info *hw_info,
586 const char *snd_card_name)
587{
588 if (!strncmp(snd_card_name, "holi-mtp-snd-card",
589 sizeof("holi-mtp-snd-card"))) {
590 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
591 } else if (!strncmp(snd_card_name, "holi-qrd-snd-card",
592 sizeof("holi-qrd-snd-card"))) {
593 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
594 } else {
595 ALOGW("%s: Not a holi device", __func__);
596 }
597 hw_info->is_stereo_spkr = false;
598}
599
Aalique Grahame03b184e2020-02-07 23:24:57 -0800600static void update_hardware_info_lahaina(
601 struct hardware_info *hw_info,
602 const char *snd_card_name)
603{
604 if (!strncmp(snd_card_name, "lahaina-mtp-snd-card",
605 sizeof("lahaina-mtp-snd-card"))) {
606 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
607 } else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card",
608 sizeof("lahaina-qrd-snd-card"))) {
609 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
610 hw_info->is_stereo_spkr = true;
Meng Wang20405952020-05-19 09:57:28 +0800611 } else if (!strncmp(snd_card_name, "lahaina-cdp-snd-card",
612 sizeof("lahaina-cdp-snd-card"))) {
613 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Aalique Grahame03b184e2020-02-07 23:24:57 -0800614 } else {
615 ALOGW("%s: Not a lahaina device", __func__);
616 }
617}
618
Josh Kirschf20adbf2018-03-06 16:26:22 -0800619static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name)
620{
621 if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) {
622 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
623 strlcpy(hw_info->name, "sda845", sizeof(hw_info->name));
624 hw_info->snd_devices = NULL;
625 hw_info->num_snd_devices = 0;
626 hw_info->is_stereo_spkr = false;
627 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
628 } else {
629 ALOGW("%s: Not a sda845 device", __func__);
630 }
631}
632
Xiaoyu Yec494c752017-11-02 18:52:48 -0700633static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused)
634{
635 ALOGW("%s: Not a sdx device", __func__);
636}
637
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700638static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
639{
640 if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
641 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
642 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
643 hw_info->snd_devices = NULL;
644 hw_info->num_snd_devices = 0;
645 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
646 } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
647 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
648 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
649 hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
650 hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800651 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700652 } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
653 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
654 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
655 hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
656 hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
657 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
658 } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
659 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
660 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
661 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
662 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
663 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
664 } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
665 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
666 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
667 hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
668 hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
669 strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
670 } else {
671 ALOGW("%s: Not an 8974 device", __func__);
672 }
673}
674
675static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
676{
677 if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
678 strlcpy(hw_info->type, "", sizeof(hw_info->type));
679 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
680 hw_info->snd_devices = NULL;
681 hw_info->num_snd_devices = 0;
682 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
683 } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
684 strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
685 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
686 hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
687 hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
688 strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
689 } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
690 strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
691 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
692 hw_info->snd_devices = NULL;
693 hw_info->num_snd_devices = 0;
694 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
695 } else {
696 ALOGW("%s: Not an 8x10 device", __func__);
697 }
698}
699
700static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
701{
702 if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
703 strlcpy(hw_info->type, "", sizeof(hw_info->type));
704 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
705 hw_info->snd_devices = NULL;
706 hw_info->num_snd_devices = 0;
707 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
708 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
709 strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
710 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
711 hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
712 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
713 strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
714 } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
715 strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
716 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
717 hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
718 hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
719 strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
720 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
721 strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
722 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
723 hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
724 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
725 strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
726 } else {
727 ALOGW("%s: Not an 8x26 device", __func__);
728 }
729}
730
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530731static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name)
732{
Walter Yang319c6fe2017-09-21 17:09:39 +0800733 if (!strncmp(snd_card_name, "sdm660-snd-card",
Meng Wang923204f2018-05-21 18:32:41 +0800734 sizeof("sdm660-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530735 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530736 } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) {
737 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
738 } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) {
739 hw_info->is_stereo_spkr = false;
740 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
741 } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) {
742 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800743 } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card",
744 sizeof("qcs405-sku1-snd-card"))) {
Dhananjay Kumar75c9a0c2018-06-07 15:59:00 +0530745 strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800746 } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card",
747 sizeof("qcs605-lc-snd-card"))) {
Sachin Mohan Gadageffd7562018-02-13 17:10:09 +0530748 strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name));
yang liu9f4232d2018-09-18 20:51:11 +0800749 } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card",
750 sizeof("qcs605-ipc-tavil-snd-card"))) {
751 strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800752 } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card",
753 sizeof("sdm660-tavil-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530754 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800755 } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card",
756 sizeof("sdm670-skuw-snd-card"))) {
Walter Yang319c6fe2017-09-21 17:09:39 +0800757 hw_info->is_stereo_spkr = false;
Meng Wang923204f2018-05-21 18:32:41 +0800758 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
759 sizeof("sdm670-tavil-hdk-snd-card"))) {
760 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
761 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
762 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
763 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
764 hw_info->is_stereo_spkr = false;
765 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530766 } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card",
767 sizeof("sm6150-idp-snd-card"))) {
768 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Aditya Bavanari4dbceed2018-10-11 18:31:55 +0530769 } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card",
770 sizeof("sm6150-wcd9375-snd-card"))) {
771 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Xiaojun Sangfcddd672018-08-15 17:53:48 +0800772 } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card",
773 sizeof("sm6150-qrd-snd-card"))) {
774 hw_info->is_stereo_spkr = false;
775 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
kunleiz3ae92e52019-04-28 15:35:31 +0800776 } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card",
777 sizeof("sm6150-wcd9375qrd-snd-card"))) {
778 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
779 hw_info->is_stereo_spkr = false;
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530780 } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card",
781 sizeof("sm6150-tavil-snd-card"))) {
782 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530783 hw_info->is_stereo_spkr = false;
784 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
785 sizeof("sdm670-tavil-hdk-snd-card"))) {
786 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
787 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
788 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
789 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
790 hw_info->is_stereo_spkr = false;
791 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530792 } else if (!strncmp(snd_card_name, "trinket-idp-snd-card",
793 sizeof("trinket-idp-snd-card"))) {
794 hw_info->is_stereo_spkr = false;
795 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
796 } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card",
797 sizeof("trinket-tashalite-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530798 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Arungopal Kondaveeti0a90c622022-06-07 17:14:51 +0530799 } else if (!strncmp(snd_card_name, "trinket-facepay-tashalite-snd-card",
800 sizeof("trinket-facepay-tashalite-snd-card"))) {
801 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530802 } else if (!strncmp(snd_card_name, "trinket-tasha-snd-card",
803 sizeof("trinket-tasha-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530804 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
805 } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card",
806 sizeof("trinket-tavil-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530807 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530808 } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card",
809 sizeof("sa6155-adp-star-snd-card"))) {
810 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
811 strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name));
812 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
813 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
814 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
Meng Wang923204f2018-05-21 18:32:41 +0800815 } else {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530816 ALOGW("%s: Not an SDM device", __func__);
Meng Wang923204f2018-05-21 18:32:41 +0800817 }
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530818}
819
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530820static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name)
821{
822 if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
823 hw_info->is_stereo_spkr = false;
824 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
825 } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
826 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
827 } else {
828 ALOGW("%s: Not an SDM439 device", __func__);
829 }
830}
831
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530832static void update_hardware_info_msm8937(struct hardware_info *hw_info, const char *snd_card_name)
833{
834 if (!strcmp(snd_card_name, "msm8937-snd-card-mtp")) {
835 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
836 } else if (!strcmp(snd_card_name, "msm8937-tasha-snd-card")) {
837 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
838 } else if (!strcmp(snd_card_name, "msm8937-tashalite-snd-card")) {
839 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
840 }
841}
842
843static void update_hardware_info_msm8953(struct hardware_info *hw_info, const char *snd_card_name)
844{
845 if (!strcmp(snd_card_name, "msm8953-snd-card-mtp")) {
846 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
847 } else if (!strcmp(snd_card_name, "msm8953-sku3-tasha-snd-card")) {
848 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
849 } else if (!strcmp(snd_card_name, "msm8953-tasha-snd-card")) {
850 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
851 } else if (!strcmp(snd_card_name, "msm8953-tashalite-snd-card")) {
852 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
853 } else if (!strcmp(snd_card_name, "msm8953-sku4-snd-card")) {
854 hw_info->is_stereo_spkr = false;
855 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
856 }
857}
858
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530859static void update_hardware_info_msm8952(struct hardware_info *hw_info, const char *snd_card_name)
860{
861 if (!strcmp(snd_card_name, "msm8952-snd-card")) {
862 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
863 } else if (!strcmp(snd_card_name, "msm8952-snd-card-mtp")) {
864 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
865 } else if (!strcmp(snd_card_name, "msm8952-tomtom-snd-card")) {
866 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
867 } else if (!strcmp(snd_card_name, "msm8952-tasha-snd-card")) {
868 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
869 } else if (!strcmp(snd_card_name, "msm8952-tashalite-snd-card")) {
870 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
871 } else if (!strcmp(snd_card_name, "msm8952-skum-snd-card")) {
872 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
873 } else if (!strcmp(snd_card_name, "msm8952-sku1-snd-card")) {
874 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
875 } else if (!strcmp(snd_card_name, "msm8952-sku2-snd-card")) {
876 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
877 } else if (!strcmp(snd_card_name, "msm8952-sku3-tasha-snd-card")) {
878 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
879 }
880}
881
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700882void *hw_info_init(const char *snd_card_name)
883{
884 struct hardware_info *hw_info;
885
886 hw_info = malloc(sizeof(struct hardware_info));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700887 if (!hw_info) {
888 ALOGE("failed to allocate mem for hardware info");
889 return NULL;
890 }
891
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800892 hw_info->snd_devices = NULL;
893 hw_info->num_snd_devices = 0;
Rohit kumard3c3b912016-11-15 18:50:31 +0530894 hw_info->is_stereo_spkr = true;
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530895 hw_info->is_wsa_combo_suppported = false;
Mingming Yin0e1b2902014-05-19 18:20:59 -0700896 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
897 strlcpy(hw_info->type, "", sizeof(hw_info->type));
898 strlcpy(hw_info->name, "", sizeof(hw_info->name));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700899
900 if(strstr(snd_card_name, "msm8974") ||
901 strstr(snd_card_name, "apq8074")) {
902 ALOGV("8974 - variant soundcard");
903 update_hardware_info_8974(hw_info, snd_card_name);
904 } else if(strstr(snd_card_name, "msm8226")) {
905 ALOGV("8x26 - variant soundcard");
906 update_hardware_info_8226(hw_info, snd_card_name);
907 } else if(strstr(snd_card_name, "msm8x10")) {
908 ALOGV("8x10 - variant soundcard");
909 update_hardware_info_8610(hw_info, snd_card_name);
910 } else if(strstr(snd_card_name, "apq8084")) {
911 ALOGV("8084 - variant soundcard");
912 update_hardware_info_8084(hw_info, snd_card_name);
Mingming Yin0e1b2902014-05-19 18:20:59 -0700913 } else if(strstr(snd_card_name, "msm8994")) {
914 ALOGV("8994 - variant soundcard");
915 update_hardware_info_8994(hw_info, snd_card_name);
Josh Kirschc3894372016-03-28 15:59:48 -0700916 } else if(strstr(snd_card_name, "apq8096")) {
917 ALOGV("8096 - variant soundcard");
918 update_hardware_info_8096(hw_info, snd_card_name);
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700919 } else if(strstr(snd_card_name, "msm8996")) {
920 ALOGV("8996 - variant soundcard");
921 update_hardware_info_8996(hw_info, snd_card_name);
Venkataraman Nerellapallib8689ec2017-05-04 11:55:29 +0530922 } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) {
Ben Romberger22d41232016-11-16 14:55:25 -0800923 ALOGV("MSM8998 - variant soundcard");
924 update_hardware_info_msm8998(hw_info, snd_card_name);
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700925 } else if(strstr(snd_card_name, "sdm845")) {
926 ALOGV("SDM845 - variant soundcard");
927 update_hardware_info_sdm845(hw_info, snd_card_name);
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530928 } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670")
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530929 || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc")
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530930 || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc")
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530931 || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530932 ALOGV("Bear - variant soundcard");
933 update_hardware_info_bear(hw_info, snd_card_name);
Walter Yang558e1132018-01-02 11:47:19 +0800934 } else if (strstr(snd_card_name, "sdx")) {
Xiaoyu Yec494c752017-11-02 18:52:48 -0700935 ALOGV("SDX - variant soundcard");
936 update_hardware_info_sdx(hw_info, snd_card_name);
Derek Chen4d6f7702018-07-07 14:04:27 -0700937 } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") ||
938 strstr(snd_card_name, "sa8155")) {
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800939 ALOGV("MSMNILE - variant soundcard");
940 update_hardware_info_msmnile(hw_info, snd_card_name);
Josh Kirschf20adbf2018-03-06 16:26:22 -0800941 } else if (strstr(snd_card_name, "sda845")) {
942 ALOGV("SDA845 - variant soundcard");
943 update_hardware_info_sda845(hw_info, snd_card_name);
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530944 } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito")
Harshal Ahire46374152019-10-22 11:37:12 +0530945 || strstr(snd_card_name, "atoll") || strstr(snd_card_name, "bengal")) {
Meng Wangef2f6e12018-10-08 13:06:05 +0800946 ALOGV("KONA - variant soundcard");
947 update_hardware_info_kona(hw_info, snd_card_name);
Aalique Grahame03b184e2020-02-07 23:24:57 -0800948 } else if(strstr(snd_card_name, "lahaina")) {
949 ALOGV("LAHAINA - variant soundcard");
950 update_hardware_info_lahaina(hw_info, snd_card_name);
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530951 } else if(strstr(snd_card_name, "holi")) {
952 ALOGV("HOLI - variant soundcard");
953 update_hardware_info_holi(hw_info, snd_card_name);
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530954 } else if(strstr(snd_card_name, "sdm439")) {
955 ALOGV("SDM439 - variant soundcard");
956 update_hardware_info_sdm439(hw_info, snd_card_name);
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530957 } else if (strstr(snd_card_name, "msm8937")) {
958 ALOGV("MSM8937 - variant soundcard");
959 update_hardware_info_msm8937(hw_info, snd_card_name);
960 } else if (strstr(snd_card_name, "msm8953")) {
961 ALOGV("MSM8953 - variant soundcard");
962 update_hardware_info_msm8953(hw_info, snd_card_name);
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530963 } else if (strstr(snd_card_name, "msm8952")) {
964 ALOGV("MSM8952 - variant soundcard");
965 update_hardware_info_msm8952(hw_info, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700966 } else {
Mingming Yin834543b2013-12-30 15:52:43 -0800967 ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700968 free(hw_info);
969 hw_info = NULL;
970 }
971
972 return hw_info;
973}
974
975void hw_info_deinit(void *hw_info)
976{
977 struct hardware_info *my_data = (struct hardware_info*) hw_info;
978
979 if(!my_data)
980 free(my_data);
981}
982
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530983void hw_info_enable_wsa_combo_usecase_support(void *hw_info)
984{
985 struct hardware_info *my_data = (struct hardware_info*) hw_info;
986 if(!my_data) {
987 ALOGE(" ERROR wsa combo update is called with invalid hw_info");
988 return;
989 }
990 my_data->is_wsa_combo_suppported = true;
991
992}
993
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700994void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
995 char *device_name)
996{
997 struct hardware_info *my_data = (struct hardware_info*) hw_info;
998 uint32_t i = 0;
999
1000 snd_device_t *snd_devices =
1001 (snd_device_t *) my_data->snd_devices;
1002
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301003
1004 if(my_data->is_wsa_combo_suppported) {
1005 for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) {
1006 if (snd_device == (snd_device_t)wsa_combo_devices[i]) {
1007 char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0};
1008 ALOGD("appending wsa extension to device %s",
1009 device_name);
1010 strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION,
1011 sizeof(WSA_MIXER_PATH_EXTENSION)) ;
1012 strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE);
1013 strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1);
1014 break;
1015 }
1016 }
1017 }
1018
1019
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001020 if(snd_devices != NULL) {
1021 for (i = 0; i < my_data->num_snd_devices; i++) {
1022 if (snd_device == (snd_device_t)snd_devices[i]) {
1023 ALOGV("extract dev_extn device %d, extn = %s",
1024 (snd_device_t)snd_devices[i], my_data->dev_extn);
1025 CHECK(strlcat(device_name, my_data->dev_extn,
1026 DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
1027 break;
1028 }
1029 }
1030 }
1031 ALOGD("%s : device_name = %s", __func__,device_name);
1032}
Rohit kumard3c3b912016-11-15 18:50:31 +05301033
1034bool hw_info_is_stereo_spkr(void *hw_info)
1035{
1036 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1037
1038 return my_data->is_stereo_spkr;
1039}