blob: c2196186fb5e104ddfb30741f15bed4986ecb840 [file] [log] [blame]
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001/*
Meng Wangae9a9b72020-12-25 14:26:10 +08002 * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07003 *
Sandhya Mutha Naga Venkata4c6fc9f2022-10-14 19:38:02 +05304 * Changes from Qualcomm Innovation Center are provided under the following license:
5 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
6 * SPDX-License-Identifier: BSD-3-Clause-Clear
7 *
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07008 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of The Linux Foundation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#define LOG_TAG "hardware_info"
35/*#define LOG_NDEBUG 0*/
36#define LOG_NDDEBUG 0
37
38#include <stdlib.h>
39#include <dlfcn.h>
Aalique Grahame22e49102018-12-18 14:23:57 -080040#include <log/log.h>
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070041#include <cutils/str_parms.h>
42#include "audio_hw.h"
43#include "platform.h"
44#include "platform_api.h"
45
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053046#ifdef DYNAMIC_LOG_ENABLED
47#include <log_xml_parser.h>
48#define LOG_MASK HAL_MOD_FILE_HW_INFO
49#include <log_utils.h>
50#endif
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070051
52struct hardware_info {
53 char name[HW_INFO_ARRAY_MAX_SIZE];
54 char type[HW_INFO_ARRAY_MAX_SIZE];
55 /* variables for handling target variants */
56 uint32_t num_snd_devices;
57 char dev_extn[HW_INFO_ARRAY_MAX_SIZE];
58 snd_device_t *snd_devices;
Sujin Panickerb904fbe2019-04-04 13:28:07 +053059 bool is_wsa_combo_suppported;
Rohit kumard3c3b912016-11-15 18:50:31 +053060 bool is_stereo_spkr;
Kunlei Zhangf755aee2020-08-13 15:02:57 +080061 bool use_mono_spkr_for_qmic;
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070062};
63
64#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
Sujin Panickerb904fbe2019-04-04 13:28:07 +053065#define WSA_MIXER_PATH_EXTENSION "wsa-"
66
67static const snd_device_t wsa_combo_devices[] = {
68 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
69 SND_DEVICE_OUT_SPEAKER_AND_LINE,
70 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
71 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
Ramlal Karraab51d042019-08-08 19:02:35 +053072 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
73 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_HIFI_FILTER
Sujin Panickerb904fbe2019-04-04 13:28:07 +053074};
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070075
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070076static const snd_device_t taiko_fluid_variant_devices[] = {
77 SND_DEVICE_OUT_SPEAKER,
78 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
79 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
80};
81
82static const snd_device_t taiko_CDP_variant_devices[] = {
83 SND_DEVICE_OUT_SPEAKER,
84 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
85 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080086 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070087};
88
Banajit Goswamid60ca7f2013-11-16 20:55:49 -080089static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
90 SND_DEVICE_IN_HANDSET_MIC,
91};
92
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070093static const snd_device_t taiko_liquid_variant_devices[] = {
94 SND_DEVICE_OUT_SPEAKER,
95 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
96 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
97 SND_DEVICE_IN_SPEAKER_MIC,
98 SND_DEVICE_IN_HEADSET_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080099 SND_DEVICE_IN_VOICE_DMIC,
100 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
101 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
102 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
103 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800104 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
105 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700106};
107
Mingming Yin0e1b2902014-05-19 18:20:59 -0700108static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = {
109 SND_DEVICE_IN_HANDSET_MIC,
110};
111
112static const snd_device_t tomtom_liquid_variant_devices[] = {
113 SND_DEVICE_OUT_SPEAKER,
Tanya Finkelb762e502014-07-10 08:03:01 -0700114 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
115 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700116 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
117 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
118 SND_DEVICE_IN_SPEAKER_MIC,
119 SND_DEVICE_IN_HEADSET_MIC,
120 SND_DEVICE_IN_VOICE_DMIC,
121 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
122 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
123 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
124 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800125 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
126 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700127};
128
129static const snd_device_t tomtom_stp_variant_devices[] = {
130 SND_DEVICE_OUT_SPEAKER,
131 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
132 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
133};
134
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700135static const snd_device_t taiko_DB_variant_devices[] = {
136 SND_DEVICE_OUT_SPEAKER,
137 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
138 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
139 SND_DEVICE_IN_SPEAKER_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800140 SND_DEVICE_IN_HEADSET_MIC,
141 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700142};
143
Tanya Finkelca735962014-11-05 23:17:25 +0200144static const snd_device_t tomtom_DB_variant_devices[] = {
145 SND_DEVICE_OUT_SPEAKER,
146 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
147 SND_DEVICE_OUT_SPEAKER_EXTERNAL_2,
148 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
149 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
150 SND_DEVICE_OUT_VOICE_SPEAKER,
151 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
152 SND_DEVICE_IN_HANDSET_MIC,
153 SND_DEVICE_IN_HANDSET_MIC_EXTERNAL
154};
155
Tanya Finkel2f96e842015-06-29 13:27:57 +0300156static const snd_device_t tasha_DB_variant_devices[] = {
157 SND_DEVICE_OUT_SPEAKER
158};
159
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300160static const snd_device_t tasha_sbc_variant_devices[] = {
161 SND_DEVICE_IN_HANDSET_MIC
162};
163
Tanya Finkel4594f752014-02-13 15:10:17 +0200164static const snd_device_t taiko_apq8084_sbc_variant_devices[] = {
165 SND_DEVICE_IN_HANDSET_MIC,
166 SND_DEVICE_IN_SPEAKER_MIC,
167};
168
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700169static const snd_device_t tapan_lite_variant_devices[] = {
170 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800171 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700172 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800173 SND_DEVICE_OUT_VOICE_HEADPHONES,
174 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
175 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700176};
177
178static const snd_device_t tapan_skuf_variant_devices[] = {
179 SND_DEVICE_OUT_SPEAKER,
180 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
181 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800182 /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700183};
184
185static const snd_device_t tapan_lite_skuf_variant_devices[] = {
186 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800187 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700188 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800189 SND_DEVICE_OUT_VOICE_HEADPHONES,
190 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
191 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700192};
193
194static const snd_device_t helicon_skuab_variant_devices[] = {
195 SND_DEVICE_OUT_SPEAKER,
196 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
197 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Walter Yang1d50ce62014-02-21 11:12:58 +0800198 SND_DEVICE_OUT_VOICE_SPEAKER,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700199};
200
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700201static const snd_device_t tasha_fluid_variant_devices[] = {
202 SND_DEVICE_OUT_SPEAKER,
203 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
204 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
205 SND_DEVICE_OUT_VOICE_SPEAKER,
206 SND_DEVICE_OUT_SPEAKER_AND_HDMI,
207 SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET,
208 SND_DEVICE_OUT_SPEAKER_PROTECTED,
209 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
210};
211
212static const snd_device_t tasha_liquid_variant_devices[] = {
213 SND_DEVICE_OUT_SPEAKER,
214 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
215 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
216 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
217 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
218 SND_DEVICE_IN_SPEAKER_MIC,
219 SND_DEVICE_IN_HEADSET_MIC,
220 SND_DEVICE_IN_VOICE_DMIC,
221 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
222 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
223 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
224 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800225 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
226 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700227};
228
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500229
Xiaoyu Ye11380482017-07-19 16:47:59 -0700230static const snd_device_t tavil_qrd_variant_devices[] = {
Karthikeyan Mani1e8a4b72017-08-24 11:05:50 -0700231 SND_DEVICE_OUT_SPEAKER,
232 SND_DEVICE_OUT_VOICE_SPEAKER,
233 SND_DEVICE_OUT_HANDSET,
234 SND_DEVICE_OUT_VOICE_HANDSET,
235 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Xiaoyu Ye11380482017-07-19 16:47:59 -0700236};
237
Meng Wang91affea2018-06-04 15:16:26 +0800238static const snd_device_t tavil_qrd_msmnile_variant_devices[] = {
239 SND_DEVICE_OUT_SPEAKER,
240 SND_DEVICE_OUT_VOICE_SPEAKER,
241 SND_DEVICE_OUT_HANDSET,
242 SND_DEVICE_OUT_VOICE_HANDSET,
243 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Yunfei Zhangf1bba382018-09-28 19:15:16 +0800244 SND_DEVICE_IN_VOICE_HEADSET_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800245 SND_DEVICE_IN_HANDSET_MIC,
246 SND_DEVICE_IN_HANDSET_MIC_AEC,
247 SND_DEVICE_IN_HANDSET_MIC_NS,
248 SND_DEVICE_IN_HANDSET_MIC_AEC_NS,
Meng Wang91affea2018-06-04 15:16:26 +0800249 SND_DEVICE_IN_SPEAKER_MIC,
kunleiz9644b272018-06-12 18:14:26 +0800250 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800251 SND_DEVICE_IN_SPEAKER_MIC_AEC,
252 SND_DEVICE_IN_SPEAKER_MIC_NS,
253 SND_DEVICE_IN_SPEAKER_MIC_AEC_NS,
kunleiz9644b272018-06-12 18:14:26 +0800254 SND_DEVICE_IN_VOICE_DMIC,
255 SND_DEVICE_IN_HANDSET_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800256 SND_DEVICE_IN_HANDSET_DMIC_NS,
257 SND_DEVICE_IN_HANDSET_DMIC_AEC,
258 SND_DEVICE_IN_HANDSET_DMIC_AEC_NS,
Aalique Grahame22e49102018-12-18 14:23:57 -0800259 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
260 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
kunleiz9644b272018-06-12 18:14:26 +0800261 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800262 SND_DEVICE_IN_SPEAKER_DMIC_AEC,
263 SND_DEVICE_IN_SPEAKER_DMIC_NS,
264 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS,
kunleiz4b4db4b2018-07-09 13:04:07 +0800265 SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
266 SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
267 SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
268 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
kunleiz9644b272018-06-12 18:14:26 +0800269 SND_DEVICE_IN_THREE_MIC,
270 SND_DEVICE_IN_HANDSET_TMIC,
271 SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO,
272 SND_DEVICE_IN_HANDSET_TMIC_AEC,
273 SND_DEVICE_IN_HANDSET_TMIC_NS,
274 SND_DEVICE_IN_HANDSET_TMIC_AEC_NS,
275 SND_DEVICE_IN_VOICE_SPEAKER_TMIC,
276 SND_DEVICE_IN_SPEAKER_TMIC_AEC,
277 SND_DEVICE_IN_SPEAKER_TMIC_NS,
278 SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS,
279 SND_DEVICE_IN_QUAD_MIC,
280 SND_DEVICE_IN_HANDSET_QMIC,
281 SND_DEVICE_IN_SPEAKER_QMIC_AEC,
282 SND_DEVICE_IN_SPEAKER_QMIC_NS,
283 SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
284 SND_DEVICE_IN_VOICE_SPEAKER_QMIC,
285 SND_DEVICE_IN_AANC_HANDSET_MIC,
286 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
287 SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
Xiaojun Sangfa1db6f2018-07-10 16:35:23 +0800288 SND_DEVICE_OUT_SPEAKER_PROTECTED,
289 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
290 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED,
Meng Wang91affea2018-06-04 15:16:26 +0800291};
292
293
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500294static const snd_device_t auto_variant_devices[] = {
295 SND_DEVICE_OUT_SPEAKER
296};
297
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700298static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name)
299{
Helen Zeng6a16ad72014-02-23 22:04:44 -0800300 if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card") ||
301 !strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card",
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800302 sizeof("apq8084-taiko-i2s-mtp-snd-card")) ||
303 !strncmp(snd_card_name, "apq8084-tomtom-mtp-snd-card",
304 sizeof("apq8084-tomtom-mtp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700305 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
306 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
307 hw_info->snd_devices = NULL;
308 hw_info->num_snd_devices = 0;
309 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800310 } else if ((!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) ||
311 !strncmp(snd_card_name, "apq8084-tomtom-cdp-snd-card",
312 sizeof("apq8084-tomtom-cdp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700313 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
314 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800315 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_CDP_variant_devices;
316 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_CDP_variant_devices);
317 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Helen Zeng6a16ad72014-02-23 22:04:44 -0800318 } else if (!strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card",
319 sizeof("apq8084-taiko-i2s-cdp-snd-card"))) {
320 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
321 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
322 hw_info->snd_devices = NULL;
323 hw_info->num_snd_devices = 0;
324 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700325 } else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) {
326 strlcpy(hw_info->type , " liquid", sizeof(hw_info->type));
327 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type));
328 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
329 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800330 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel4594f752014-02-13 15:10:17 +0200331 } else if (!strcmp(snd_card_name, "apq8084-taiko-sbc-snd-card")) {
332 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
333 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
334 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_sbc_variant_devices;
335 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_sbc_variant_devices);
336 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700337 } else {
338 ALOGW("%s: Not an 8084 device", __func__);
339 }
340}
341
Josh Kirschc3894372016-03-28 15:59:48 -0700342static void update_hardware_info_8096(struct hardware_info *hw_info, const char *snd_card_name)
343{
344 if (!strcmp(snd_card_name, "apq8096-tasha-i2c-snd-card")) {
345 ALOGW("%s: Updating hardware info for APQ 8096", __func__);
346 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
347 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
348 hw_info->snd_devices = NULL;
349 hw_info->num_snd_devices = 0;
350 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500351 } else if (!strcmp(snd_card_name, "apq8096-auto-snd-card")) {
352 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
353 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
354 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
355 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
356 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
357 } else if (!strcmp(snd_card_name, "apq8096-adp-agave-snd-card")) {
358 strlcpy(hw_info->type, " agave", sizeof(hw_info->type));
359 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
360 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
361 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
362 strlcpy(hw_info->dev_extn, "-agave", sizeof(hw_info->dev_extn));
363 } else if (!strcmp(snd_card_name, "apq8096-adp-mmxf-snd-card")) {
364 strlcpy(hw_info->type, " mmxf", sizeof(hw_info->type));
365 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
366 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
367 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
368 strlcpy(hw_info->dev_extn, "-mmxf", sizeof(hw_info->dev_extn));
Josh Kirschc3894372016-03-28 15:59:48 -0700369 } else {
370 ALOGW("%s: Not an 8096 device", __func__);
371 }
372}
373
Mingming Yin0e1b2902014-05-19 18:20:59 -0700374static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name)
375{
376 if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) {
377 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
378 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
379 hw_info->snd_devices = NULL;
380 hw_info->num_snd_devices = 0;
381 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700382 } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700383 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
384 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
385 hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
386 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
387 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700388 } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700389 strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
390 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
391 hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
392 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
393 strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700394 } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700395 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
396 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
397 hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
398 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices);
399 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkelca735962014-11-05 23:17:25 +0200400 } else if (!strcmp(snd_card_name, "msm8994-tomtom-db-snd-card")) {
401 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
402 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
403 hw_info->snd_devices = (snd_device_t *)tomtom_DB_variant_devices;
404 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_DB_variant_devices);
405 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Mingming Yin0e1b2902014-05-19 18:20:59 -0700406 } else {
407 ALOGW("%s: Not an 8994 device", __func__);
408 }
409}
410
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700411static void update_hardware_info_8996(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami22582e72014-10-15 18:29:34 -0700412{
Neema Shetty52a72c72015-08-26 12:26:06 -0700413 if (!strcmp(snd_card_name, "msm8996-tasha-fluid-snd-card")) {
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700414 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
415 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
416 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
417 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
418 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
419 } else if (!strcmp(snd_card_name, "msm8996-tasha-liquid-snd-card")) {
420 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
421 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
422 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
423 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
424 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel2f96e842015-06-29 13:27:57 +0300425 } else if (!strcmp(snd_card_name, "msm8996-tasha-db-snd-card")) {
426 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
427 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
428 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
429 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
430 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300431 } else if (!strcmp(snd_card_name, "msm8996-tasha-sbc-snd-card")) {
432 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
433 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
434 hw_info->snd_devices = (snd_device_t *)tasha_sbc_variant_devices;
435 hw_info->num_snd_devices = ARRAY_SIZE(tasha_sbc_variant_devices);
436 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Banajit Goswami22582e72014-10-15 18:29:34 -0700437 } else {
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700438 ALOGW("%s: Not a 8996 device", __func__);
Banajit Goswami22582e72014-10-15 18:29:34 -0700439 }
440}
441
Ben Romberger22d41232016-11-16 14:55:25 -0800442static void update_hardware_info_msm8998(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800443{
Ben Romberger22d41232016-11-16 14:55:25 -0800444 if (!strcmp(snd_card_name, "msm8998-tasha-fluid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800445 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800446 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800447 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
448 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
Rohit kumard3c3b912016-11-15 18:50:31 +0530449 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800450 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800451 } else if (!strcmp(snd_card_name, "msm8998-tasha-liquid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800452 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800453 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800454 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
455 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
456 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800457 } else if (!strcmp(snd_card_name, "msm8998-tasha-db-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800458 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800459 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800460 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
461 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
462 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
kunleizaa6a3f12017-01-19 12:28:28 +0800463 } else if (!strcmp(snd_card_name, "msm8998-qvr-tavil-snd-card")) {
464 hw_info->is_stereo_spkr = false;
465 } else if (!strcmp(snd_card_name, "msm8998-skuk-tavil-snd-card")) {
466 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800467 } else {
Ben Romberger22d41232016-11-16 14:55:25 -0800468 ALOGW("%s: Not a msm8998 device", __func__);
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800469 }
470}
471
Xiaoyu Ye11380482017-07-19 16:47:59 -0700472static void update_hardware_info_sdm845(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700473{
Xiaoyu Ye11380482017-07-19 16:47:59 -0700474 if (!strcmp(snd_card_name, "sdm845-tavil-qrd-snd-card")) {
475 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
476 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
477 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
478 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
479 hw_info->is_stereo_spkr = false;
480 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Meng Wang69b865c2017-10-30 15:12:12 +0800481 } else if (!strcmp(snd_card_name, "sdm845-tavil-hdk-snd-card")) {
482 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
483 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
484 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
485 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
486 hw_info->is_stereo_spkr = false;
487 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Meng Wang43a5e102017-11-01 10:49:01 +0800488 } else if (!strcmp(snd_card_name, "sdm845-qvr-tavil-snd-card")) {
489 hw_info->is_stereo_spkr = false;
Xiaoyu Ye11380482017-07-19 16:47:59 -0700490 } else {
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700491 ALOGW("%s: Not a sdm845 device", __func__);
Xiaoyu Ye11380482017-07-19 16:47:59 -0700492 }
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700493}
494
Meng Wang8e5dccc2018-03-05 15:52:24 +0800495static void update_hardware_info_msmnile(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800496{
Meng Wang8e5dccc2018-03-05 15:52:24 +0800497 if (strstr(snd_card_name, "qrd")) {
498 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
499 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
Meng Wang91affea2018-06-04 15:16:26 +0800500 hw_info->snd_devices = (snd_device_t *)tavil_qrd_msmnile_variant_devices;
501 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_msmnile_variant_devices);
Meng Wang8e5dccc2018-03-05 15:52:24 +0800502 hw_info->is_stereo_spkr = false;
503 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Vidyakumar Athota460cc662018-04-01 21:05:57 -0700504 } else if (strstr(snd_card_name, "pahu")) {
505 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
506 hw_info->is_stereo_spkr = false;
Derek Chen4d6f7702018-07-07 14:04:27 -0700507 } else if (strstr(snd_card_name, "adp")) {
508 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
509 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
510 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
511 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
512 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
513 } else if (strstr(snd_card_name, "custom")) {
514 strlcpy(hw_info->type, "custom", sizeof(hw_info->type));
515 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
516 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
517 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
518 strlcpy(hw_info->dev_extn, "-custom", sizeof(hw_info->dev_extn));
Meng Wang8e5dccc2018-03-05 15:52:24 +0800519 } else {
520 ALOGW("%s: Not a msmnile device", __func__);
521 }
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800522}
523
Meng Wangef2f6e12018-10-08 13:06:05 +0800524static void update_hardware_info_kona(
525 struct hardware_info *hw_info,
526 const char *snd_card_name)
527{
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800528 if (!strncmp(snd_card_name, "lito-lagoonmtp-snd-card",
529 sizeof("lito-lagoonmtp-snd-card"))) {
530 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
531 } else if (!strncmp(snd_card_name, "lito-lagoonqrd-snd-card",
532 sizeof("lito-lagoonqrd-snd-card"))) {
533 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
534 hw_info->is_stereo_spkr = false;
Subhadra Jagadeesan38ebdca2020-09-09 16:59:43 +0530535 } else if (!strncmp(snd_card_name, "lito-orchidmtp-snd-card",
536 sizeof("lito-orchidmtp-snd-card"))) {
537 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800538 } else if (!strncmp(snd_card_name, "bengal-idp-snd-card",
Harshal Ahire46374152019-10-22 11:37:12 +0530539 sizeof("bengal-idp-snd-card"))) {
540 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
541 hw_info->is_stereo_spkr = false;
Aditya Bavanari05999be2020-03-12 20:12:32 +0530542 } else if (!strncmp(snd_card_name, "bengal-scubaidp-snd-card",
543 sizeof("bengal-scubaidp-snd-card"))) {
544 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
545 hw_info->is_stereo_spkr = false;
Harshal Ahire46374152019-10-22 11:37:12 +0530546 } else if (!strncmp(snd_card_name, "kona-mtp-snd-card",
Meng Wangef2f6e12018-10-08 13:06:05 +0800547 sizeof("kona-mtp-snd-card"))) {
548 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
Vatsal Bucha6339b092019-04-17 16:27:32 +0530549 } else if (!strncmp(snd_card_name, "lito-mtp-snd-card",
550 sizeof("lito-mtp-snd-card"))) {
551 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530552 } else if (!strncmp(snd_card_name, "atoll-idp-snd-card",
553 sizeof("atoll-idp-snd-card"))) {
554 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
555 } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card",
556 sizeof("atoll-wcd937x-snd-card"))) {
557 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
Kunlei Zhang47509fc2019-08-16 16:41:28 +0800558 } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card",
559 sizeof("atoll-qrd-snd-card"))) {
560 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
561 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800562 } else if (!strncmp(snd_card_name, "kona-qrd-snd-card",
563 sizeof("kona-qrd-snd-card"))) {
564 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
565 hw_info->is_stereo_spkr = false;
Vatsal Bucha6339b092019-04-17 16:27:32 +0530566 } else if (!strncmp(snd_card_name, "lito-qrd-snd-card",
567 sizeof("lito-qrd-snd-card"))) {
568 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
569 hw_info->is_stereo_spkr = false;
Kunlei Zhang57215122019-12-30 13:43:31 +0800570 } else if (!strncmp(snd_card_name, "bengal-qrd-snd-card",
571 sizeof("bengal-qrd-snd-card"))) {
572 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
573 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800574 } else {
575 ALOGW("%s: Not a kona device", __func__);
576 }
577}
578
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530579static void update_hardware_info_holi(
580 struct hardware_info *hw_info,
581 const char *snd_card_name)
582{
583 if (!strncmp(snd_card_name, "holi-mtp-snd-card",
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530584 sizeof("holi-mtp-snd-card")) ||
585 !strncmp(snd_card_name, "holi-qrd-snd-card",
586 sizeof("holi-qrd-snd-card")) ||
Amarnath Vangala2e663cf2020-09-22 23:15:15 +0530587 !strncmp(snd_card_name, "holi-usbc-snd-card",
588 sizeof("holi-usbc-snd-card")) ||
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530589 !strncmp(snd_card_name, "holi-qrdsku1-snd-card",
590 sizeof("holi-qrdsku1-snd-card")) ||
591 !strncmp(snd_card_name, "holi-mtpsku1-snd-card",
592 sizeof("holi-mtpsku1-snd-card"))) {
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530593 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530594 hw_info->is_stereo_spkr = false;
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530595 } else {
596 ALOGW("%s: Not a holi device", __func__);
597 }
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530598}
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));
Kunlei Zhangf755aee2020-08-13 15:02:57 +0800607 hw_info->use_mono_spkr_for_qmic = true;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800608 } else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card",
609 sizeof("lahaina-qrd-snd-card"))) {
610 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
611 hw_info->is_stereo_spkr = true;
Meng Wang20405952020-05-19 09:57:28 +0800612 } else if (!strncmp(snd_card_name, "lahaina-cdp-snd-card",
613 sizeof("lahaina-cdp-snd-card"))) {
614 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Meng Wangc1c97392020-08-13 15:57:28 +0800615 } else if (!strncmp(snd_card_name, "lahaina-hdk-snd-card",
616 sizeof("lahaina-hdk-snd-card"))) {
617 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
618 hw_info->is_stereo_spkr = false;
Meng Wangae9a9b72020-12-25 14:26:10 +0800619 } else if (!strncmp(snd_card_name, "lahaina-hhg-snd-card",
620 sizeof("lahaina-hhg-snd-card"))) {
621 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
622 hw_info->is_stereo_spkr = true;
Faiz Nabi Kuchay1adff8f2020-07-21 11:25:11 +0530623 } else if (!strncmp(snd_card_name, "lahaina-shimaidp-snd-card",
624 sizeof("lahaina-shimaidp-snd-card"))) {
625 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
626 } else if (!strncmp(snd_card_name, "lahaina-shimaidps-snd-card",
627 sizeof("lahaina-shimaidps-snd-card"))) {
628 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
629 } else if (!strncmp(snd_card_name, "lahaina-shimaqrd-snd-card",
630 sizeof("lahaina-shimaqrd-snd-card"))) {
631 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
Xiaojun Sanga5197a92020-07-28 10:28:55 +0800632 hw_info->is_stereo_spkr = false;
Vatsal Bucha3a080c62020-11-27 22:23:12 +0530633 } else if (!strncmp(snd_card_name, "lahaina-yupikidp-snd-card",
634 sizeof("lahaina-yupikidp-snd-card"))) {
635 strlcpy(hw_info->name, "yupik", sizeof(hw_info->name));
636 } else if (!strncmp(snd_card_name, "lahaina-yupikqrd-snd-card",
637 sizeof("lahaina-yupikqrd-snd-card"))) {
638 strlcpy(hw_info->name, "yupik", sizeof(hw_info->name));
639 hw_info->is_stereo_spkr = false;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800640 } else {
641 ALOGW("%s: Not a lahaina device", __func__);
642 }
643}
644
Josh Kirschf20adbf2018-03-06 16:26:22 -0800645static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name)
646{
647 if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) {
648 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
649 strlcpy(hw_info->name, "sda845", sizeof(hw_info->name));
650 hw_info->snd_devices = NULL;
651 hw_info->num_snd_devices = 0;
652 hw_info->is_stereo_spkr = false;
653 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
654 } else {
655 ALOGW("%s: Not a sda845 device", __func__);
656 }
657}
658
Xiaoyu Yec494c752017-11-02 18:52:48 -0700659static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused)
660{
661 ALOGW("%s: Not a sdx device", __func__);
662}
663
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700664static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
665{
666 if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
667 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
668 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
669 hw_info->snd_devices = NULL;
670 hw_info->num_snd_devices = 0;
671 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
672 } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
673 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
674 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
675 hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
676 hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800677 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700678 } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
679 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
680 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
681 hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
682 hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
683 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
684 } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
685 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
686 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
687 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
688 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
689 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
690 } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
691 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
692 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
693 hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
694 hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
695 strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
696 } else {
697 ALOGW("%s: Not an 8974 device", __func__);
698 }
699}
700
701static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
702{
703 if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
704 strlcpy(hw_info->type, "", sizeof(hw_info->type));
705 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
706 hw_info->snd_devices = NULL;
707 hw_info->num_snd_devices = 0;
708 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
709 } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
710 strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
711 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
712 hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
713 hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
714 strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
715 } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
716 strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
717 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
718 hw_info->snd_devices = NULL;
719 hw_info->num_snd_devices = 0;
720 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
721 } else {
722 ALOGW("%s: Not an 8x10 device", __func__);
723 }
724}
725
726static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
727{
728 if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
729 strlcpy(hw_info->type, "", sizeof(hw_info->type));
730 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
731 hw_info->snd_devices = NULL;
732 hw_info->num_snd_devices = 0;
733 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
734 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
735 strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
736 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
737 hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
738 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
739 strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
740 } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
741 strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
742 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
743 hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
744 hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
745 strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
746 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
747 strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
748 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
749 hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
750 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
751 strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
752 } else {
753 ALOGW("%s: Not an 8x26 device", __func__);
754 }
755}
756
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530757static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name)
758{
Walter Yang319c6fe2017-09-21 17:09:39 +0800759 if (!strncmp(snd_card_name, "sdm660-snd-card",
Meng Wang923204f2018-05-21 18:32:41 +0800760 sizeof("sdm660-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530761 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530762 } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) {
763 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
764 } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) {
765 hw_info->is_stereo_spkr = false;
766 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
767 } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) {
768 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800769 } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card",
770 sizeof("qcs405-sku1-snd-card"))) {
Dhananjay Kumar75c9a0c2018-06-07 15:59:00 +0530771 strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800772 } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card",
773 sizeof("qcs605-lc-snd-card"))) {
Sachin Mohan Gadageffd7562018-02-13 17:10:09 +0530774 strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name));
yang liu9f4232d2018-09-18 20:51:11 +0800775 } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card",
776 sizeof("qcs605-ipc-tavil-snd-card"))) {
777 strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800778 } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card",
779 sizeof("sdm660-tavil-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530780 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800781 } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card",
782 sizeof("sdm670-skuw-snd-card"))) {
Walter Yang319c6fe2017-09-21 17:09:39 +0800783 hw_info->is_stereo_spkr = false;
Meng Wang923204f2018-05-21 18:32:41 +0800784 } 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));
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530792 } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card",
793 sizeof("sm6150-idp-snd-card"))) {
794 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Bhasker Reddy Komatireddyfd2a9ab2022-12-16 18:43:16 +0530795 } else if (!strncmp(snd_card_name, "sm6150-ipc-snd-card",
796 sizeof("sm6150-ipc-snd-card"))) {
797 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Aditya Bavanari4dbceed2018-10-11 18:31:55 +0530798 } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card",
799 sizeof("sm6150-wcd9375-snd-card"))) {
800 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Xiaojun Sangfcddd672018-08-15 17:53:48 +0800801 } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card",
802 sizeof("sm6150-qrd-snd-card"))) {
803 hw_info->is_stereo_spkr = false;
804 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
kunleiz3ae92e52019-04-28 15:35:31 +0800805 } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card",
806 sizeof("sm6150-wcd9375qrd-snd-card"))) {
807 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
808 hw_info->is_stereo_spkr = false;
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530809 } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card",
810 sizeof("sm6150-tavil-snd-card"))) {
811 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530812 hw_info->is_stereo_spkr = false;
813 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
814 sizeof("sdm670-tavil-hdk-snd-card"))) {
815 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
816 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
817 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
818 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
819 hw_info->is_stereo_spkr = false;
820 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530821 } else if (!strncmp(snd_card_name, "trinket-idp-snd-card",
822 sizeof("trinket-idp-snd-card"))) {
823 hw_info->is_stereo_spkr = false;
824 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
825 } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card",
826 sizeof("trinket-tashalite-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530827 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
828 } else if (!strncmp(snd_card_name, "trinket-tasha-snd-card",
829 sizeof("trinket-tasha-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530830 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
831 } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card",
832 sizeof("trinket-tavil-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530833 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530834 } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card",
835 sizeof("sa6155-adp-star-snd-card"))) {
836 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
837 strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name));
838 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
839 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
840 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
Meng Wang923204f2018-05-21 18:32:41 +0800841 } else {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530842 ALOGW("%s: Not an SDM device", __func__);
Meng Wang923204f2018-05-21 18:32:41 +0800843 }
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530844}
845
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530846static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name)
847{
848 if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
849 hw_info->is_stereo_spkr = false;
850 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
851 } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
852 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
sriram kumarf592aa52020-12-10 17:56:56 +0530853 /* Wearbles LW and LAW uses different sound card name on sdm429w
854 so use strstr instead of strcmp to make it generic */
855 } else if (strstr(snd_card_name, "sdm429w")) {
856 strlcpy(hw_info->name, "sdm429w", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530857 } else {
858 ALOGW("%s: Not an SDM439 device", __func__);
859 }
860}
861
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530862static void update_hardware_info_msm8937(struct hardware_info *hw_info, const char *snd_card_name)
863{
864 if (!strcmp(snd_card_name, "msm8937-snd-card-mtp")) {
865 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
866 } else if (!strcmp(snd_card_name, "msm8937-tasha-snd-card")) {
867 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
868 } else if (!strcmp(snd_card_name, "msm8937-tashalite-snd-card")) {
869 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
870 }
871}
872
873static void update_hardware_info_msm8953(struct hardware_info *hw_info, const char *snd_card_name)
874{
875 if (!strcmp(snd_card_name, "msm8953-snd-card-mtp")) {
876 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
877 } else if (!strcmp(snd_card_name, "msm8953-sku3-tasha-snd-card")) {
878 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
879 } else if (!strcmp(snd_card_name, "msm8953-tasha-snd-card")) {
880 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
881 } else if (!strcmp(snd_card_name, "msm8953-tashalite-snd-card")) {
882 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
883 } else if (!strcmp(snd_card_name, "msm8953-sku4-snd-card")) {
884 hw_info->is_stereo_spkr = false;
885 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
886 }
887}
888
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530889static void update_hardware_info_msm8952(struct hardware_info *hw_info, const char *snd_card_name)
890{
891 if (!strcmp(snd_card_name, "msm8952-snd-card")) {
892 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
893 } else if (!strcmp(snd_card_name, "msm8952-snd-card-mtp")) {
894 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
895 } else if (!strcmp(snd_card_name, "msm8952-tomtom-snd-card")) {
896 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
897 } else if (!strcmp(snd_card_name, "msm8952-tasha-snd-card")) {
898 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
899 } else if (!strcmp(snd_card_name, "msm8952-tashalite-snd-card")) {
900 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
901 } else if (!strcmp(snd_card_name, "msm8952-skum-snd-card")) {
902 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
903 } else if (!strcmp(snd_card_name, "msm8952-sku1-snd-card")) {
904 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
905 } else if (!strcmp(snd_card_name, "msm8952-sku2-snd-card")) {
906 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
907 } else if (!strcmp(snd_card_name, "msm8952-sku3-tasha-snd-card")) {
908 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
909 }
910}
911
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700912void *hw_info_init(const char *snd_card_name)
913{
914 struct hardware_info *hw_info;
915
916 hw_info = malloc(sizeof(struct hardware_info));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700917 if (!hw_info) {
918 ALOGE("failed to allocate mem for hardware info");
919 return NULL;
920 }
921
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800922 hw_info->snd_devices = NULL;
923 hw_info->num_snd_devices = 0;
Rohit kumard3c3b912016-11-15 18:50:31 +0530924 hw_info->is_stereo_spkr = true;
Kunlei Zhangf755aee2020-08-13 15:02:57 +0800925 hw_info->use_mono_spkr_for_qmic = false;
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530926 hw_info->is_wsa_combo_suppported = false;
Mingming Yin0e1b2902014-05-19 18:20:59 -0700927 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
928 strlcpy(hw_info->type, "", sizeof(hw_info->type));
929 strlcpy(hw_info->name, "", sizeof(hw_info->name));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700930
931 if(strstr(snd_card_name, "msm8974") ||
932 strstr(snd_card_name, "apq8074")) {
933 ALOGV("8974 - variant soundcard");
934 update_hardware_info_8974(hw_info, snd_card_name);
935 } else if(strstr(snd_card_name, "msm8226")) {
936 ALOGV("8x26 - variant soundcard");
937 update_hardware_info_8226(hw_info, snd_card_name);
938 } else if(strstr(snd_card_name, "msm8x10")) {
939 ALOGV("8x10 - variant soundcard");
940 update_hardware_info_8610(hw_info, snd_card_name);
941 } else if(strstr(snd_card_name, "apq8084")) {
942 ALOGV("8084 - variant soundcard");
943 update_hardware_info_8084(hw_info, snd_card_name);
Mingming Yin0e1b2902014-05-19 18:20:59 -0700944 } else if(strstr(snd_card_name, "msm8994")) {
945 ALOGV("8994 - variant soundcard");
946 update_hardware_info_8994(hw_info, snd_card_name);
Josh Kirschc3894372016-03-28 15:59:48 -0700947 } else if(strstr(snd_card_name, "apq8096")) {
948 ALOGV("8096 - variant soundcard");
949 update_hardware_info_8096(hw_info, snd_card_name);
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700950 } else if(strstr(snd_card_name, "msm8996")) {
951 ALOGV("8996 - variant soundcard");
952 update_hardware_info_8996(hw_info, snd_card_name);
Venkataraman Nerellapallib8689ec2017-05-04 11:55:29 +0530953 } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) {
Ben Romberger22d41232016-11-16 14:55:25 -0800954 ALOGV("MSM8998 - variant soundcard");
955 update_hardware_info_msm8998(hw_info, snd_card_name);
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700956 } else if(strstr(snd_card_name, "sdm845")) {
957 ALOGV("SDM845 - variant soundcard");
958 update_hardware_info_sdm845(hw_info, snd_card_name);
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530959 } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670")
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530960 || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc")
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530961 || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc")
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530962 || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530963 ALOGV("Bear - variant soundcard");
964 update_hardware_info_bear(hw_info, snd_card_name);
Walter Yang558e1132018-01-02 11:47:19 +0800965 } else if (strstr(snd_card_name, "sdx")) {
Xiaoyu Yec494c752017-11-02 18:52:48 -0700966 ALOGV("SDX - variant soundcard");
967 update_hardware_info_sdx(hw_info, snd_card_name);
Derek Chen4d6f7702018-07-07 14:04:27 -0700968 } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") ||
Deru Wangc2150382021-07-16 10:35:03 +0800969 strstr(snd_card_name, "sa8155") || strstr(snd_card_name, "sa8295")) {
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800970 ALOGV("MSMNILE - variant soundcard");
971 update_hardware_info_msmnile(hw_info, snd_card_name);
Josh Kirschf20adbf2018-03-06 16:26:22 -0800972 } else if (strstr(snd_card_name, "sda845")) {
973 ALOGV("SDA845 - variant soundcard");
974 update_hardware_info_sda845(hw_info, snd_card_name);
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530975 } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito")
Harshal Ahire46374152019-10-22 11:37:12 +0530976 || strstr(snd_card_name, "atoll") || strstr(snd_card_name, "bengal")) {
Meng Wangef2f6e12018-10-08 13:06:05 +0800977 ALOGV("KONA - variant soundcard");
978 update_hardware_info_kona(hw_info, snd_card_name);
Vatsal Bucha3a080c62020-11-27 22:23:12 +0530979 } else if(strstr(snd_card_name, "lahaina") || strstr(snd_card_name, "shima")
980 || strstr(snd_card_name, "yupik")) {
Aalique Grahame03b184e2020-02-07 23:24:57 -0800981 ALOGV("LAHAINA - variant soundcard");
982 update_hardware_info_lahaina(hw_info, snd_card_name);
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530983 } else if(strstr(snd_card_name, "holi")) {
984 ALOGV("HOLI - variant soundcard");
985 update_hardware_info_holi(hw_info, snd_card_name);
sriram kumarf592aa52020-12-10 17:56:56 +0530986 } else if(strstr(snd_card_name, "sdm439") || strstr(snd_card_name, "sdm429w")) {
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530987 ALOGV("SDM439 - variant soundcard");
988 update_hardware_info_sdm439(hw_info, snd_card_name);
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530989 } else if (strstr(snd_card_name, "msm8937")) {
990 ALOGV("MSM8937 - variant soundcard");
991 update_hardware_info_msm8937(hw_info, snd_card_name);
992 } else if (strstr(snd_card_name, "msm8953")) {
993 ALOGV("MSM8953 - variant soundcard");
994 update_hardware_info_msm8953(hw_info, snd_card_name);
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530995 } else if (strstr(snd_card_name, "msm8952")) {
996 ALOGV("MSM8952 - variant soundcard");
997 update_hardware_info_msm8952(hw_info, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700998 } else {
Mingming Yin834543b2013-12-30 15:52:43 -0800999 ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001000 free(hw_info);
1001 hw_info = NULL;
1002 }
1003
1004 return hw_info;
1005}
1006
1007void hw_info_deinit(void *hw_info)
1008{
1009 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1010
Sandhya Mutha Naga Venkata4c6fc9f2022-10-14 19:38:02 +05301011 if (my_data)
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001012 free(my_data);
1013}
1014
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301015void hw_info_enable_wsa_combo_usecase_support(void *hw_info)
1016{
1017 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1018 if(!my_data) {
1019 ALOGE(" ERROR wsa combo update is called with invalid hw_info");
1020 return;
1021 }
1022 my_data->is_wsa_combo_suppported = true;
1023
1024}
1025
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001026void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
1027 char *device_name)
1028{
1029 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1030 uint32_t i = 0;
1031
1032 snd_device_t *snd_devices =
1033 (snd_device_t *) my_data->snd_devices;
1034
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301035
1036 if(my_data->is_wsa_combo_suppported) {
1037 for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) {
1038 if (snd_device == (snd_device_t)wsa_combo_devices[i]) {
1039 char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0};
1040 ALOGD("appending wsa extension to device %s",
1041 device_name);
1042 strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION,
1043 sizeof(WSA_MIXER_PATH_EXTENSION)) ;
1044 strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE);
1045 strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1);
1046 break;
1047 }
1048 }
1049 }
1050
1051
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001052 if(snd_devices != NULL) {
1053 for (i = 0; i < my_data->num_snd_devices; i++) {
1054 if (snd_device == (snd_device_t)snd_devices[i]) {
1055 ALOGV("extract dev_extn device %d, extn = %s",
1056 (snd_device_t)snd_devices[i], my_data->dev_extn);
1057 CHECK(strlcat(device_name, my_data->dev_extn,
1058 DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
1059 break;
1060 }
1061 }
1062 }
1063 ALOGD("%s : device_name = %s", __func__,device_name);
1064}
Rohit kumard3c3b912016-11-15 18:50:31 +05301065
1066bool hw_info_is_stereo_spkr(void *hw_info)
1067{
1068 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1069
1070 return my_data->is_stereo_spkr;
1071}
Kunlei Zhangf755aee2020-08-13 15:02:57 +08001072
1073bool hw_info_use_mono_spkr_for_qmic(void *hw_info)
1074{
1075 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1076
1077 return my_data->use_mono_spkr_for_qmic;
1078}