blob: bee414b26e142074c21772d120791cfe4b202ec9 [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 *
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,
Ramlal Karraab51d042019-08-08 19:02:35 +053067 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
68 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_HIFI_FILTER
Sujin Panickerb904fbe2019-04-04 13:28:07 +053069};
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070070
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070071static const snd_device_t taiko_fluid_variant_devices[] = {
72 SND_DEVICE_OUT_SPEAKER,
73 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
74 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
75};
76
77static const snd_device_t taiko_CDP_variant_devices[] = {
78 SND_DEVICE_OUT_SPEAKER,
79 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
80 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080081 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070082};
83
Banajit Goswamid60ca7f2013-11-16 20:55:49 -080084static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
85 SND_DEVICE_IN_HANDSET_MIC,
86};
87
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070088static const snd_device_t taiko_liquid_variant_devices[] = {
89 SND_DEVICE_OUT_SPEAKER,
90 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
91 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
92 SND_DEVICE_IN_SPEAKER_MIC,
93 SND_DEVICE_IN_HEADSET_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080094 SND_DEVICE_IN_VOICE_DMIC,
95 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
96 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
97 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
98 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -080099 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
100 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700101};
102
Mingming Yin0e1b2902014-05-19 18:20:59 -0700103static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = {
104 SND_DEVICE_IN_HANDSET_MIC,
105};
106
107static const snd_device_t tomtom_liquid_variant_devices[] = {
108 SND_DEVICE_OUT_SPEAKER,
Tanya Finkelb762e502014-07-10 08:03:01 -0700109 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
110 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700111 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
112 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
113 SND_DEVICE_IN_SPEAKER_MIC,
114 SND_DEVICE_IN_HEADSET_MIC,
115 SND_DEVICE_IN_VOICE_DMIC,
116 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
117 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
118 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
119 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800120 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
121 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700122};
123
124static const snd_device_t tomtom_stp_variant_devices[] = {
125 SND_DEVICE_OUT_SPEAKER,
126 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
127 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
128};
129
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700130static const snd_device_t taiko_DB_variant_devices[] = {
131 SND_DEVICE_OUT_SPEAKER,
132 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
133 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
134 SND_DEVICE_IN_SPEAKER_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800135 SND_DEVICE_IN_HEADSET_MIC,
136 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700137};
138
Tanya Finkelca735962014-11-05 23:17:25 +0200139static const snd_device_t tomtom_DB_variant_devices[] = {
140 SND_DEVICE_OUT_SPEAKER,
141 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
142 SND_DEVICE_OUT_SPEAKER_EXTERNAL_2,
143 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
144 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
145 SND_DEVICE_OUT_VOICE_SPEAKER,
146 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
147 SND_DEVICE_IN_HANDSET_MIC,
148 SND_DEVICE_IN_HANDSET_MIC_EXTERNAL
149};
150
Tanya Finkel2f96e842015-06-29 13:27:57 +0300151static const snd_device_t tasha_DB_variant_devices[] = {
152 SND_DEVICE_OUT_SPEAKER
153};
154
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300155static const snd_device_t tasha_sbc_variant_devices[] = {
156 SND_DEVICE_IN_HANDSET_MIC
157};
158
Tanya Finkel4594f752014-02-13 15:10:17 +0200159static const snd_device_t taiko_apq8084_sbc_variant_devices[] = {
160 SND_DEVICE_IN_HANDSET_MIC,
161 SND_DEVICE_IN_SPEAKER_MIC,
162};
163
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700164static const snd_device_t tapan_lite_variant_devices[] = {
165 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800166 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700167 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800168 SND_DEVICE_OUT_VOICE_HEADPHONES,
169 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
170 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700171};
172
173static const snd_device_t tapan_skuf_variant_devices[] = {
174 SND_DEVICE_OUT_SPEAKER,
175 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
176 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800177 /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700178};
179
180static const snd_device_t tapan_lite_skuf_variant_devices[] = {
181 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800182 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700183 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800184 SND_DEVICE_OUT_VOICE_HEADPHONES,
185 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
186 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700187};
188
189static const snd_device_t helicon_skuab_variant_devices[] = {
190 SND_DEVICE_OUT_SPEAKER,
191 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
192 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Walter Yang1d50ce62014-02-21 11:12:58 +0800193 SND_DEVICE_OUT_VOICE_SPEAKER,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700194};
195
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700196static const snd_device_t tasha_fluid_variant_devices[] = {
197 SND_DEVICE_OUT_SPEAKER,
198 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
199 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
200 SND_DEVICE_OUT_VOICE_SPEAKER,
201 SND_DEVICE_OUT_SPEAKER_AND_HDMI,
202 SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET,
203 SND_DEVICE_OUT_SPEAKER_PROTECTED,
204 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
205};
206
207static const snd_device_t tasha_liquid_variant_devices[] = {
208 SND_DEVICE_OUT_SPEAKER,
209 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
210 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
211 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
212 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
213 SND_DEVICE_IN_SPEAKER_MIC,
214 SND_DEVICE_IN_HEADSET_MIC,
215 SND_DEVICE_IN_VOICE_DMIC,
216 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
217 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
218 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
219 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800220 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
221 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700222};
223
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500224
Xiaoyu Ye11380482017-07-19 16:47:59 -0700225static const snd_device_t tavil_qrd_variant_devices[] = {
Karthikeyan Mani1e8a4b72017-08-24 11:05:50 -0700226 SND_DEVICE_OUT_SPEAKER,
227 SND_DEVICE_OUT_VOICE_SPEAKER,
228 SND_DEVICE_OUT_HANDSET,
229 SND_DEVICE_OUT_VOICE_HANDSET,
230 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Xiaoyu Ye11380482017-07-19 16:47:59 -0700231};
232
Meng Wang91affea2018-06-04 15:16:26 +0800233static const snd_device_t tavil_qrd_msmnile_variant_devices[] = {
234 SND_DEVICE_OUT_SPEAKER,
235 SND_DEVICE_OUT_VOICE_SPEAKER,
236 SND_DEVICE_OUT_HANDSET,
237 SND_DEVICE_OUT_VOICE_HANDSET,
238 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Yunfei Zhangf1bba382018-09-28 19:15:16 +0800239 SND_DEVICE_IN_VOICE_HEADSET_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800240 SND_DEVICE_IN_HANDSET_MIC,
241 SND_DEVICE_IN_HANDSET_MIC_AEC,
242 SND_DEVICE_IN_HANDSET_MIC_NS,
243 SND_DEVICE_IN_HANDSET_MIC_AEC_NS,
Meng Wang91affea2018-06-04 15:16:26 +0800244 SND_DEVICE_IN_SPEAKER_MIC,
kunleiz9644b272018-06-12 18:14:26 +0800245 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800246 SND_DEVICE_IN_SPEAKER_MIC_AEC,
247 SND_DEVICE_IN_SPEAKER_MIC_NS,
248 SND_DEVICE_IN_SPEAKER_MIC_AEC_NS,
kunleiz9644b272018-06-12 18:14:26 +0800249 SND_DEVICE_IN_VOICE_DMIC,
250 SND_DEVICE_IN_HANDSET_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800251 SND_DEVICE_IN_HANDSET_DMIC_NS,
252 SND_DEVICE_IN_HANDSET_DMIC_AEC,
253 SND_DEVICE_IN_HANDSET_DMIC_AEC_NS,
Aalique Grahame22e49102018-12-18 14:23:57 -0800254 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
255 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
kunleiz9644b272018-06-12 18:14:26 +0800256 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800257 SND_DEVICE_IN_SPEAKER_DMIC_AEC,
258 SND_DEVICE_IN_SPEAKER_DMIC_NS,
259 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS,
kunleiz4b4db4b2018-07-09 13:04:07 +0800260 SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
261 SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
262 SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
263 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
kunleiz9644b272018-06-12 18:14:26 +0800264 SND_DEVICE_IN_THREE_MIC,
265 SND_DEVICE_IN_HANDSET_TMIC,
266 SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO,
267 SND_DEVICE_IN_HANDSET_TMIC_AEC,
268 SND_DEVICE_IN_HANDSET_TMIC_NS,
269 SND_DEVICE_IN_HANDSET_TMIC_AEC_NS,
270 SND_DEVICE_IN_VOICE_SPEAKER_TMIC,
271 SND_DEVICE_IN_SPEAKER_TMIC_AEC,
272 SND_DEVICE_IN_SPEAKER_TMIC_NS,
273 SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS,
274 SND_DEVICE_IN_QUAD_MIC,
275 SND_DEVICE_IN_HANDSET_QMIC,
276 SND_DEVICE_IN_SPEAKER_QMIC_AEC,
277 SND_DEVICE_IN_SPEAKER_QMIC_NS,
278 SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
279 SND_DEVICE_IN_VOICE_SPEAKER_QMIC,
280 SND_DEVICE_IN_AANC_HANDSET_MIC,
281 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
282 SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
Xiaojun Sangfa1db6f2018-07-10 16:35:23 +0800283 SND_DEVICE_OUT_SPEAKER_PROTECTED,
284 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
285 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED,
Meng Wang91affea2018-06-04 15:16:26 +0800286};
287
288
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500289static const snd_device_t auto_variant_devices[] = {
290 SND_DEVICE_OUT_SPEAKER
291};
292
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700293static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name)
294{
Helen Zeng6a16ad72014-02-23 22:04:44 -0800295 if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card") ||
296 !strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card",
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800297 sizeof("apq8084-taiko-i2s-mtp-snd-card")) ||
298 !strncmp(snd_card_name, "apq8084-tomtom-mtp-snd-card",
299 sizeof("apq8084-tomtom-mtp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700300 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
301 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
302 hw_info->snd_devices = NULL;
303 hw_info->num_snd_devices = 0;
304 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800305 } else if ((!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) ||
306 !strncmp(snd_card_name, "apq8084-tomtom-cdp-snd-card",
307 sizeof("apq8084-tomtom-cdp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700308 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
309 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800310 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_CDP_variant_devices;
311 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_CDP_variant_devices);
312 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Helen Zeng6a16ad72014-02-23 22:04:44 -0800313 } else if (!strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card",
314 sizeof("apq8084-taiko-i2s-cdp-snd-card"))) {
315 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
316 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
317 hw_info->snd_devices = NULL;
318 hw_info->num_snd_devices = 0;
319 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700320 } else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) {
321 strlcpy(hw_info->type , " liquid", sizeof(hw_info->type));
322 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type));
323 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
324 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800325 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel4594f752014-02-13 15:10:17 +0200326 } else if (!strcmp(snd_card_name, "apq8084-taiko-sbc-snd-card")) {
327 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
328 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
329 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_sbc_variant_devices;
330 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_sbc_variant_devices);
331 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700332 } else {
333 ALOGW("%s: Not an 8084 device", __func__);
334 }
335}
336
Josh Kirschc3894372016-03-28 15:59:48 -0700337static void update_hardware_info_8096(struct hardware_info *hw_info, const char *snd_card_name)
338{
339 if (!strcmp(snd_card_name, "apq8096-tasha-i2c-snd-card")) {
340 ALOGW("%s: Updating hardware info for APQ 8096", __func__);
341 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
342 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
343 hw_info->snd_devices = NULL;
344 hw_info->num_snd_devices = 0;
345 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500346 } else if (!strcmp(snd_card_name, "apq8096-auto-snd-card")) {
347 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
348 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
349 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
350 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
351 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
352 } else if (!strcmp(snd_card_name, "apq8096-adp-agave-snd-card")) {
353 strlcpy(hw_info->type, " agave", sizeof(hw_info->type));
354 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
355 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
356 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
357 strlcpy(hw_info->dev_extn, "-agave", sizeof(hw_info->dev_extn));
358 } else if (!strcmp(snd_card_name, "apq8096-adp-mmxf-snd-card")) {
359 strlcpy(hw_info->type, " mmxf", sizeof(hw_info->type));
360 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
361 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
362 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
363 strlcpy(hw_info->dev_extn, "-mmxf", sizeof(hw_info->dev_extn));
Josh Kirschc3894372016-03-28 15:59:48 -0700364 } else {
365 ALOGW("%s: Not an 8096 device", __func__);
366 }
367}
368
Mingming Yin0e1b2902014-05-19 18:20:59 -0700369static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name)
370{
371 if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) {
372 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
373 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
374 hw_info->snd_devices = NULL;
375 hw_info->num_snd_devices = 0;
376 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700377 } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700378 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
379 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
380 hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
381 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
382 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700383 } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700384 strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
385 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
386 hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
387 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
388 strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700389 } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700390 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
391 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
392 hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
393 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices);
394 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkelca735962014-11-05 23:17:25 +0200395 } else if (!strcmp(snd_card_name, "msm8994-tomtom-db-snd-card")) {
396 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
397 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
398 hw_info->snd_devices = (snd_device_t *)tomtom_DB_variant_devices;
399 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_DB_variant_devices);
400 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Mingming Yin0e1b2902014-05-19 18:20:59 -0700401 } else {
402 ALOGW("%s: Not an 8994 device", __func__);
403 }
404}
405
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700406static void update_hardware_info_8996(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami22582e72014-10-15 18:29:34 -0700407{
Neema Shetty52a72c72015-08-26 12:26:06 -0700408 if (!strcmp(snd_card_name, "msm8996-tasha-fluid-snd-card")) {
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700409 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
410 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
411 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
412 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
413 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
414 } else if (!strcmp(snd_card_name, "msm8996-tasha-liquid-snd-card")) {
415 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
416 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
417 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
418 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
419 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel2f96e842015-06-29 13:27:57 +0300420 } else if (!strcmp(snd_card_name, "msm8996-tasha-db-snd-card")) {
421 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
422 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
423 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
424 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
425 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300426 } else if (!strcmp(snd_card_name, "msm8996-tasha-sbc-snd-card")) {
427 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
428 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
429 hw_info->snd_devices = (snd_device_t *)tasha_sbc_variant_devices;
430 hw_info->num_snd_devices = ARRAY_SIZE(tasha_sbc_variant_devices);
431 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Banajit Goswami22582e72014-10-15 18:29:34 -0700432 } else {
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700433 ALOGW("%s: Not a 8996 device", __func__);
Banajit Goswami22582e72014-10-15 18:29:34 -0700434 }
435}
436
Ben Romberger22d41232016-11-16 14:55:25 -0800437static void update_hardware_info_msm8998(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800438{
Ben Romberger22d41232016-11-16 14:55:25 -0800439 if (!strcmp(snd_card_name, "msm8998-tasha-fluid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800440 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800441 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800442 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
443 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
Rohit kumard3c3b912016-11-15 18:50:31 +0530444 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800445 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800446 } else if (!strcmp(snd_card_name, "msm8998-tasha-liquid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800447 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800448 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800449 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
450 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
451 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800452 } else if (!strcmp(snd_card_name, "msm8998-tasha-db-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800453 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800454 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800455 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
456 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
457 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
kunleizaa6a3f12017-01-19 12:28:28 +0800458 } else if (!strcmp(snd_card_name, "msm8998-qvr-tavil-snd-card")) {
459 hw_info->is_stereo_spkr = false;
460 } else if (!strcmp(snd_card_name, "msm8998-skuk-tavil-snd-card")) {
461 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800462 } else {
Ben Romberger22d41232016-11-16 14:55:25 -0800463 ALOGW("%s: Not a msm8998 device", __func__);
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800464 }
465}
466
Xiaoyu Ye11380482017-07-19 16:47:59 -0700467static void update_hardware_info_sdm845(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700468{
Xiaoyu Ye11380482017-07-19 16:47:59 -0700469 if (!strcmp(snd_card_name, "sdm845-tavil-qrd-snd-card")) {
470 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
471 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
472 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
473 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
474 hw_info->is_stereo_spkr = false;
475 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Meng Wang69b865c2017-10-30 15:12:12 +0800476 } else if (!strcmp(snd_card_name, "sdm845-tavil-hdk-snd-card")) {
477 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
478 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
479 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
480 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
481 hw_info->is_stereo_spkr = false;
482 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Meng Wang43a5e102017-11-01 10:49:01 +0800483 } else if (!strcmp(snd_card_name, "sdm845-qvr-tavil-snd-card")) {
484 hw_info->is_stereo_spkr = false;
Xiaoyu Ye11380482017-07-19 16:47:59 -0700485 } else {
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700486 ALOGW("%s: Not a sdm845 device", __func__);
Xiaoyu Ye11380482017-07-19 16:47:59 -0700487 }
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700488}
489
Meng Wang8e5dccc2018-03-05 15:52:24 +0800490static void update_hardware_info_msmnile(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800491{
Meng Wang8e5dccc2018-03-05 15:52:24 +0800492 if (strstr(snd_card_name, "qrd")) {
493 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
494 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
Meng Wang91affea2018-06-04 15:16:26 +0800495 hw_info->snd_devices = (snd_device_t *)tavil_qrd_msmnile_variant_devices;
496 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_msmnile_variant_devices);
Meng Wang8e5dccc2018-03-05 15:52:24 +0800497 hw_info->is_stereo_spkr = false;
498 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Vidyakumar Athota460cc662018-04-01 21:05:57 -0700499 } else if (strstr(snd_card_name, "pahu")) {
500 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
501 hw_info->is_stereo_spkr = false;
Derek Chen4d6f7702018-07-07 14:04:27 -0700502 } else if (strstr(snd_card_name, "adp")) {
503 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
504 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
505 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
506 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
507 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
508 } else if (strstr(snd_card_name, "custom")) {
509 strlcpy(hw_info->type, "custom", sizeof(hw_info->type));
510 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
511 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
512 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
513 strlcpy(hw_info->dev_extn, "-custom", sizeof(hw_info->dev_extn));
Meng Wang8e5dccc2018-03-05 15:52:24 +0800514 } else {
515 ALOGW("%s: Not a msmnile device", __func__);
516 }
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800517}
518
Meng Wangef2f6e12018-10-08 13:06:05 +0800519static void update_hardware_info_kona(
520 struct hardware_info *hw_info,
521 const char *snd_card_name)
522{
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800523 if (!strncmp(snd_card_name, "lito-lagoonmtp-snd-card",
524 sizeof("lito-lagoonmtp-snd-card"))) {
525 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
526 } else if (!strncmp(snd_card_name, "lito-lagoonqrd-snd-card",
527 sizeof("lito-lagoonqrd-snd-card"))) {
528 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
529 hw_info->is_stereo_spkr = false;
530 } else if (!strncmp(snd_card_name, "bengal-idp-snd-card",
Harshal Ahire46374152019-10-22 11:37:12 +0530531 sizeof("bengal-idp-snd-card"))) {
532 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
533 hw_info->is_stereo_spkr = false;
Aditya Bavanari05999be2020-03-12 20:12:32 +0530534 } else if (!strncmp(snd_card_name, "bengal-scubaidp-snd-card",
535 sizeof("bengal-scubaidp-snd-card"))) {
536 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
537 hw_info->is_stereo_spkr = false;
Harshal Ahire46374152019-10-22 11:37:12 +0530538 } else if (!strncmp(snd_card_name, "kona-mtp-snd-card",
Meng Wangef2f6e12018-10-08 13:06:05 +0800539 sizeof("kona-mtp-snd-card"))) {
540 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
Vatsal Bucha6339b092019-04-17 16:27:32 +0530541 } else if (!strncmp(snd_card_name, "lito-mtp-snd-card",
542 sizeof("lito-mtp-snd-card"))) {
543 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530544 } else if (!strncmp(snd_card_name, "atoll-idp-snd-card",
545 sizeof("atoll-idp-snd-card"))) {
546 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
547 } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card",
548 sizeof("atoll-wcd937x-snd-card"))) {
549 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
Kunlei Zhang47509fc2019-08-16 16:41:28 +0800550 } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card",
551 sizeof("atoll-qrd-snd-card"))) {
552 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
553 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800554 } else if (!strncmp(snd_card_name, "kona-qrd-snd-card",
555 sizeof("kona-qrd-snd-card"))) {
556 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
557 hw_info->is_stereo_spkr = false;
Vatsal Bucha6339b092019-04-17 16:27:32 +0530558 } else if (!strncmp(snd_card_name, "lito-qrd-snd-card",
559 sizeof("lito-qrd-snd-card"))) {
560 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
561 hw_info->is_stereo_spkr = false;
Kunlei Zhang57215122019-12-30 13:43:31 +0800562 } else if (!strncmp(snd_card_name, "bengal-qrd-snd-card",
563 sizeof("bengal-qrd-snd-card"))) {
564 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
565 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800566 } else {
567 ALOGW("%s: Not a kona device", __func__);
568 }
569}
570
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530571static void update_hardware_info_holi(
572 struct hardware_info *hw_info,
573 const char *snd_card_name)
574{
575 if (!strncmp(snd_card_name, "holi-mtp-snd-card",
576 sizeof("holi-mtp-snd-card"))) {
577 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
578 } else if (!strncmp(snd_card_name, "holi-qrd-snd-card",
579 sizeof("holi-qrd-snd-card"))) {
580 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
581 } else {
582 ALOGW("%s: Not a holi device", __func__);
583 }
584 hw_info->is_stereo_spkr = false;
585}
586
Aalique Grahame03b184e2020-02-07 23:24:57 -0800587static void update_hardware_info_lahaina(
588 struct hardware_info *hw_info,
589 const char *snd_card_name)
590{
591 if (!strncmp(snd_card_name, "lahaina-mtp-snd-card",
592 sizeof("lahaina-mtp-snd-card"))) {
593 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
594 } else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card",
595 sizeof("lahaina-qrd-snd-card"))) {
596 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
597 hw_info->is_stereo_spkr = true;
Meng Wang20405952020-05-19 09:57:28 +0800598 } else if (!strncmp(snd_card_name, "lahaina-cdp-snd-card",
599 sizeof("lahaina-cdp-snd-card"))) {
600 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Faiz Nabi Kuchay1adff8f2020-07-21 11:25:11 +0530601 } else if (!strncmp(snd_card_name, "lahaina-shimaidp-snd-card",
602 sizeof("lahaina-shimaidp-snd-card"))) {
603 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
604 } else if (!strncmp(snd_card_name, "lahaina-shimaidps-snd-card",
605 sizeof("lahaina-shimaidps-snd-card"))) {
606 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
607 } else if (!strncmp(snd_card_name, "lahaina-shimaqrd-snd-card",
608 sizeof("lahaina-shimaqrd-snd-card"))) {
609 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
Xiaojun Sanga5197a92020-07-28 10:28:55 +0800610 hw_info->is_stereo_spkr = false;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800611 } else {
612 ALOGW("%s: Not a lahaina device", __func__);
613 }
614}
615
Josh Kirschf20adbf2018-03-06 16:26:22 -0800616static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name)
617{
618 if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) {
619 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
620 strlcpy(hw_info->name, "sda845", sizeof(hw_info->name));
621 hw_info->snd_devices = NULL;
622 hw_info->num_snd_devices = 0;
623 hw_info->is_stereo_spkr = false;
624 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
625 } else {
626 ALOGW("%s: Not a sda845 device", __func__);
627 }
628}
629
Xiaoyu Yec494c752017-11-02 18:52:48 -0700630static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused)
631{
632 ALOGW("%s: Not a sdx device", __func__);
633}
634
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700635static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
636{
637 if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
638 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
639 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
640 hw_info->snd_devices = NULL;
641 hw_info->num_snd_devices = 0;
642 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
643 } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
644 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
645 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
646 hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
647 hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800648 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700649 } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
650 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
651 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
652 hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
653 hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
654 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
655 } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
656 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
657 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
658 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
659 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
660 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
661 } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
662 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
663 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
664 hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
665 hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
666 strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
667 } else {
668 ALOGW("%s: Not an 8974 device", __func__);
669 }
670}
671
672static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
673{
674 if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
675 strlcpy(hw_info->type, "", sizeof(hw_info->type));
676 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
677 hw_info->snd_devices = NULL;
678 hw_info->num_snd_devices = 0;
679 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
680 } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
681 strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
682 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
683 hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
684 hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
685 strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
686 } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
687 strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
688 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
689 hw_info->snd_devices = NULL;
690 hw_info->num_snd_devices = 0;
691 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
692 } else {
693 ALOGW("%s: Not an 8x10 device", __func__);
694 }
695}
696
697static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
698{
699 if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
700 strlcpy(hw_info->type, "", sizeof(hw_info->type));
701 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
702 hw_info->snd_devices = NULL;
703 hw_info->num_snd_devices = 0;
704 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
705 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
706 strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
707 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
708 hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
709 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
710 strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
711 } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
712 strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
713 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
714 hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
715 hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
716 strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
717 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
718 strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
719 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
720 hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
721 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
722 strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
723 } else {
724 ALOGW("%s: Not an 8x26 device", __func__);
725 }
726}
727
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530728static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name)
729{
Walter Yang319c6fe2017-09-21 17:09:39 +0800730 if (!strncmp(snd_card_name, "sdm660-snd-card",
Meng Wang923204f2018-05-21 18:32:41 +0800731 sizeof("sdm660-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530732 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530733 } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) {
734 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
735 } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) {
736 hw_info->is_stereo_spkr = false;
737 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
738 } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) {
739 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800740 } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card",
741 sizeof("qcs405-sku1-snd-card"))) {
Dhananjay Kumar75c9a0c2018-06-07 15:59:00 +0530742 strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800743 } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card",
744 sizeof("qcs605-lc-snd-card"))) {
Sachin Mohan Gadageffd7562018-02-13 17:10:09 +0530745 strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name));
yang liu9f4232d2018-09-18 20:51:11 +0800746 } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card",
747 sizeof("qcs605-ipc-tavil-snd-card"))) {
748 strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800749 } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card",
750 sizeof("sdm660-tavil-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530751 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800752 } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card",
753 sizeof("sdm670-skuw-snd-card"))) {
Walter Yang319c6fe2017-09-21 17:09:39 +0800754 hw_info->is_stereo_spkr = false;
Meng Wang923204f2018-05-21 18:32:41 +0800755 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
756 sizeof("sdm670-tavil-hdk-snd-card"))) {
757 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
758 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
759 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
760 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
761 hw_info->is_stereo_spkr = false;
762 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530763 } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card",
764 sizeof("sm6150-idp-snd-card"))) {
765 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Aditya Bavanari4dbceed2018-10-11 18:31:55 +0530766 } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card",
767 sizeof("sm6150-wcd9375-snd-card"))) {
768 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Xiaojun Sangfcddd672018-08-15 17:53:48 +0800769 } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card",
770 sizeof("sm6150-qrd-snd-card"))) {
771 hw_info->is_stereo_spkr = false;
772 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
kunleiz3ae92e52019-04-28 15:35:31 +0800773 } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card",
774 sizeof("sm6150-wcd9375qrd-snd-card"))) {
775 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
776 hw_info->is_stereo_spkr = false;
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530777 } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card",
778 sizeof("sm6150-tavil-snd-card"))) {
779 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530780 hw_info->is_stereo_spkr = false;
781 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
782 sizeof("sdm670-tavil-hdk-snd-card"))) {
783 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
784 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
785 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
786 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
787 hw_info->is_stereo_spkr = false;
788 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530789 } else if (!strncmp(snd_card_name, "trinket-idp-snd-card",
790 sizeof("trinket-idp-snd-card"))) {
791 hw_info->is_stereo_spkr = false;
792 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
793 } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card",
794 sizeof("trinket-tashalite-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530795 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
796 } else if (!strncmp(snd_card_name, "trinket-tasha-snd-card",
797 sizeof("trinket-tasha-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530798 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
799 } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card",
800 sizeof("trinket-tavil-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530801 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530802 } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card",
803 sizeof("sa6155-adp-star-snd-card"))) {
804 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
805 strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name));
806 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
807 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
808 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
Meng Wang923204f2018-05-21 18:32:41 +0800809 } else {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530810 ALOGW("%s: Not an SDM device", __func__);
Meng Wang923204f2018-05-21 18:32:41 +0800811 }
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530812}
813
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530814static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name)
815{
816 if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
817 hw_info->is_stereo_spkr = false;
818 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
819 } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
820 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
821 } else {
822 ALOGW("%s: Not an SDM439 device", __func__);
823 }
824}
825
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530826static void update_hardware_info_msm8937(struct hardware_info *hw_info, const char *snd_card_name)
827{
828 if (!strcmp(snd_card_name, "msm8937-snd-card-mtp")) {
829 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
830 } else if (!strcmp(snd_card_name, "msm8937-tasha-snd-card")) {
831 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
832 } else if (!strcmp(snd_card_name, "msm8937-tashalite-snd-card")) {
833 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
834 }
835}
836
837static void update_hardware_info_msm8953(struct hardware_info *hw_info, const char *snd_card_name)
838{
839 if (!strcmp(snd_card_name, "msm8953-snd-card-mtp")) {
840 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
841 } else if (!strcmp(snd_card_name, "msm8953-sku3-tasha-snd-card")) {
842 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
843 } else if (!strcmp(snd_card_name, "msm8953-tasha-snd-card")) {
844 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
845 } else if (!strcmp(snd_card_name, "msm8953-tashalite-snd-card")) {
846 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
847 } else if (!strcmp(snd_card_name, "msm8953-sku4-snd-card")) {
848 hw_info->is_stereo_spkr = false;
849 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
850 }
851}
852
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530853static void update_hardware_info_msm8952(struct hardware_info *hw_info, const char *snd_card_name)
854{
855 if (!strcmp(snd_card_name, "msm8952-snd-card")) {
856 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
857 } else if (!strcmp(snd_card_name, "msm8952-snd-card-mtp")) {
858 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
859 } else if (!strcmp(snd_card_name, "msm8952-tomtom-snd-card")) {
860 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
861 } else if (!strcmp(snd_card_name, "msm8952-tasha-snd-card")) {
862 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
863 } else if (!strcmp(snd_card_name, "msm8952-tashalite-snd-card")) {
864 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
865 } else if (!strcmp(snd_card_name, "msm8952-skum-snd-card")) {
866 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
867 } else if (!strcmp(snd_card_name, "msm8952-sku1-snd-card")) {
868 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
869 } else if (!strcmp(snd_card_name, "msm8952-sku2-snd-card")) {
870 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
871 } else if (!strcmp(snd_card_name, "msm8952-sku3-tasha-snd-card")) {
872 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
873 }
874}
875
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700876void *hw_info_init(const char *snd_card_name)
877{
878 struct hardware_info *hw_info;
879
880 hw_info = malloc(sizeof(struct hardware_info));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700881 if (!hw_info) {
882 ALOGE("failed to allocate mem for hardware info");
883 return NULL;
884 }
885
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800886 hw_info->snd_devices = NULL;
887 hw_info->num_snd_devices = 0;
Rohit kumard3c3b912016-11-15 18:50:31 +0530888 hw_info->is_stereo_spkr = true;
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530889 hw_info->is_wsa_combo_suppported = false;
Mingming Yin0e1b2902014-05-19 18:20:59 -0700890 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
891 strlcpy(hw_info->type, "", sizeof(hw_info->type));
892 strlcpy(hw_info->name, "", sizeof(hw_info->name));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700893
894 if(strstr(snd_card_name, "msm8974") ||
895 strstr(snd_card_name, "apq8074")) {
896 ALOGV("8974 - variant soundcard");
897 update_hardware_info_8974(hw_info, snd_card_name);
898 } else if(strstr(snd_card_name, "msm8226")) {
899 ALOGV("8x26 - variant soundcard");
900 update_hardware_info_8226(hw_info, snd_card_name);
901 } else if(strstr(snd_card_name, "msm8x10")) {
902 ALOGV("8x10 - variant soundcard");
903 update_hardware_info_8610(hw_info, snd_card_name);
904 } else if(strstr(snd_card_name, "apq8084")) {
905 ALOGV("8084 - variant soundcard");
906 update_hardware_info_8084(hw_info, snd_card_name);
Mingming Yin0e1b2902014-05-19 18:20:59 -0700907 } else if(strstr(snd_card_name, "msm8994")) {
908 ALOGV("8994 - variant soundcard");
909 update_hardware_info_8994(hw_info, snd_card_name);
Josh Kirschc3894372016-03-28 15:59:48 -0700910 } else if(strstr(snd_card_name, "apq8096")) {
911 ALOGV("8096 - variant soundcard");
912 update_hardware_info_8096(hw_info, snd_card_name);
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700913 } else if(strstr(snd_card_name, "msm8996")) {
914 ALOGV("8996 - variant soundcard");
915 update_hardware_info_8996(hw_info, snd_card_name);
Venkataraman Nerellapallib8689ec2017-05-04 11:55:29 +0530916 } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) {
Ben Romberger22d41232016-11-16 14:55:25 -0800917 ALOGV("MSM8998 - variant soundcard");
918 update_hardware_info_msm8998(hw_info, snd_card_name);
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700919 } else if(strstr(snd_card_name, "sdm845")) {
920 ALOGV("SDM845 - variant soundcard");
921 update_hardware_info_sdm845(hw_info, snd_card_name);
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530922 } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670")
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530923 || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc")
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530924 || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc")
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530925 || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530926 ALOGV("Bear - variant soundcard");
927 update_hardware_info_bear(hw_info, snd_card_name);
Walter Yang558e1132018-01-02 11:47:19 +0800928 } else if (strstr(snd_card_name, "sdx")) {
Xiaoyu Yec494c752017-11-02 18:52:48 -0700929 ALOGV("SDX - variant soundcard");
930 update_hardware_info_sdx(hw_info, snd_card_name);
Derek Chen4d6f7702018-07-07 14:04:27 -0700931 } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") ||
932 strstr(snd_card_name, "sa8155")) {
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800933 ALOGV("MSMNILE - variant soundcard");
934 update_hardware_info_msmnile(hw_info, snd_card_name);
Josh Kirschf20adbf2018-03-06 16:26:22 -0800935 } else if (strstr(snd_card_name, "sda845")) {
936 ALOGV("SDA845 - variant soundcard");
937 update_hardware_info_sda845(hw_info, snd_card_name);
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530938 } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito")
Harshal Ahire46374152019-10-22 11:37:12 +0530939 || strstr(snd_card_name, "atoll") || strstr(snd_card_name, "bengal")) {
Meng Wangef2f6e12018-10-08 13:06:05 +0800940 ALOGV("KONA - variant soundcard");
941 update_hardware_info_kona(hw_info, snd_card_name);
Faiz Nabi Kuchay1adff8f2020-07-21 11:25:11 +0530942 } else if(strstr(snd_card_name, "lahaina") || strstr(snd_card_name, "shima")) {
Aalique Grahame03b184e2020-02-07 23:24:57 -0800943 ALOGV("LAHAINA - variant soundcard");
944 update_hardware_info_lahaina(hw_info, snd_card_name);
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530945 } else if(strstr(snd_card_name, "holi")) {
946 ALOGV("HOLI - variant soundcard");
947 update_hardware_info_holi(hw_info, snd_card_name);
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530948 } else if(strstr(snd_card_name, "sdm439")) {
949 ALOGV("SDM439 - variant soundcard");
950 update_hardware_info_sdm439(hw_info, snd_card_name);
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530951 } else if (strstr(snd_card_name, "msm8937")) {
952 ALOGV("MSM8937 - variant soundcard");
953 update_hardware_info_msm8937(hw_info, snd_card_name);
954 } else if (strstr(snd_card_name, "msm8953")) {
955 ALOGV("MSM8953 - variant soundcard");
956 update_hardware_info_msm8953(hw_info, snd_card_name);
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530957 } else if (strstr(snd_card_name, "msm8952")) {
958 ALOGV("MSM8952 - variant soundcard");
959 update_hardware_info_msm8952(hw_info, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700960 } else {
Mingming Yin834543b2013-12-30 15:52:43 -0800961 ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700962 free(hw_info);
963 hw_info = NULL;
964 }
965
966 return hw_info;
967}
968
969void hw_info_deinit(void *hw_info)
970{
971 struct hardware_info *my_data = (struct hardware_info*) hw_info;
972
973 if(!my_data)
974 free(my_data);
975}
976
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530977void hw_info_enable_wsa_combo_usecase_support(void *hw_info)
978{
979 struct hardware_info *my_data = (struct hardware_info*) hw_info;
980 if(!my_data) {
981 ALOGE(" ERROR wsa combo update is called with invalid hw_info");
982 return;
983 }
984 my_data->is_wsa_combo_suppported = true;
985
986}
987
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700988void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
989 char *device_name)
990{
991 struct hardware_info *my_data = (struct hardware_info*) hw_info;
992 uint32_t i = 0;
993
994 snd_device_t *snd_devices =
995 (snd_device_t *) my_data->snd_devices;
996
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530997
998 if(my_data->is_wsa_combo_suppported) {
999 for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) {
1000 if (snd_device == (snd_device_t)wsa_combo_devices[i]) {
1001 char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0};
1002 ALOGD("appending wsa extension to device %s",
1003 device_name);
1004 strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION,
1005 sizeof(WSA_MIXER_PATH_EXTENSION)) ;
1006 strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE);
1007 strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1);
1008 break;
1009 }
1010 }
1011 }
1012
1013
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001014 if(snd_devices != NULL) {
1015 for (i = 0; i < my_data->num_snd_devices; i++) {
1016 if (snd_device == (snd_device_t)snd_devices[i]) {
1017 ALOGV("extract dev_extn device %d, extn = %s",
1018 (snd_device_t)snd_devices[i], my_data->dev_extn);
1019 CHECK(strlcat(device_name, my_data->dev_extn,
1020 DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
1021 break;
1022 }
1023 }
1024 }
1025 ALOGD("%s : device_name = %s", __func__,device_name);
1026}
Rohit kumard3c3b912016-11-15 18:50:31 +05301027
1028bool hw_info_is_stereo_spkr(void *hw_info)
1029{
1030 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1031
1032 return my_data->is_stereo_spkr;
1033}