blob: 789ecd6fd5ef2af42b0cf07a56cd746f965296fa [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 *
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;
Kunlei Zhangf755aee2020-08-13 15:02:57 +080057 bool use_mono_spkr_for_qmic;
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070058};
59
60#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
Sujin Panickerb904fbe2019-04-04 13:28:07 +053061#define WSA_MIXER_PATH_EXTENSION "wsa-"
62
63static const snd_device_t wsa_combo_devices[] = {
64 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
65 SND_DEVICE_OUT_SPEAKER_AND_LINE,
66 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
67 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
Ramlal Karraab51d042019-08-08 19:02:35 +053068 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
69 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_HIFI_FILTER
Sujin Panickerb904fbe2019-04-04 13:28:07 +053070};
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070071
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070072static const snd_device_t taiko_fluid_variant_devices[] = {
73 SND_DEVICE_OUT_SPEAKER,
74 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
75 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
76};
77
78static const snd_device_t taiko_CDP_variant_devices[] = {
79 SND_DEVICE_OUT_SPEAKER,
80 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
81 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080082 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070083};
84
Banajit Goswamid60ca7f2013-11-16 20:55:49 -080085static const snd_device_t taiko_apq8084_CDP_variant_devices[] = {
86 SND_DEVICE_IN_HANDSET_MIC,
87};
88
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070089static const snd_device_t taiko_liquid_variant_devices[] = {
90 SND_DEVICE_OUT_SPEAKER,
91 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
92 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
93 SND_DEVICE_IN_SPEAKER_MIC,
94 SND_DEVICE_IN_HEADSET_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -080095 SND_DEVICE_IN_VOICE_DMIC,
96 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
97 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
98 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
99 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800100 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
101 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700102};
103
Mingming Yin0e1b2902014-05-19 18:20:59 -0700104static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = {
105 SND_DEVICE_IN_HANDSET_MIC,
106};
107
108static const snd_device_t tomtom_liquid_variant_devices[] = {
109 SND_DEVICE_OUT_SPEAKER,
Tanya Finkelb762e502014-07-10 08:03:01 -0700110 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
111 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700112 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
113 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
114 SND_DEVICE_IN_SPEAKER_MIC,
115 SND_DEVICE_IN_HEADSET_MIC,
116 SND_DEVICE_IN_VOICE_DMIC,
117 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
118 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
119 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
120 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800121 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
122 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Mingming Yin0e1b2902014-05-19 18:20:59 -0700123};
124
125static const snd_device_t tomtom_stp_variant_devices[] = {
126 SND_DEVICE_OUT_SPEAKER,
127 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
128 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
129};
130
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700131static const snd_device_t taiko_DB_variant_devices[] = {
132 SND_DEVICE_OUT_SPEAKER,
133 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
134 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
135 SND_DEVICE_IN_SPEAKER_MIC,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800136 SND_DEVICE_IN_HEADSET_MIC,
137 SND_DEVICE_IN_QUAD_MIC,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700138};
139
Tanya Finkelca735962014-11-05 23:17:25 +0200140static const snd_device_t tomtom_DB_variant_devices[] = {
141 SND_DEVICE_OUT_SPEAKER,
142 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
143 SND_DEVICE_OUT_SPEAKER_EXTERNAL_2,
144 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
145 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
146 SND_DEVICE_OUT_VOICE_SPEAKER,
147 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
148 SND_DEVICE_IN_HANDSET_MIC,
149 SND_DEVICE_IN_HANDSET_MIC_EXTERNAL
150};
151
Tanya Finkel2f96e842015-06-29 13:27:57 +0300152static const snd_device_t tasha_DB_variant_devices[] = {
153 SND_DEVICE_OUT_SPEAKER
154};
155
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300156static const snd_device_t tasha_sbc_variant_devices[] = {
157 SND_DEVICE_IN_HANDSET_MIC
158};
159
Tanya Finkel4594f752014-02-13 15:10:17 +0200160static const snd_device_t taiko_apq8084_sbc_variant_devices[] = {
161 SND_DEVICE_IN_HANDSET_MIC,
162 SND_DEVICE_IN_SPEAKER_MIC,
163};
164
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700165static const snd_device_t tapan_lite_variant_devices[] = {
166 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800167 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700168 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800169 SND_DEVICE_OUT_VOICE_HEADPHONES,
170 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
171 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700172};
173
174static const snd_device_t tapan_skuf_variant_devices[] = {
175 SND_DEVICE_OUT_SPEAKER,
176 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
177 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800178 /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700179};
180
181static const snd_device_t tapan_lite_skuf_variant_devices[] = {
182 SND_DEVICE_OUT_SPEAKER,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800183 SND_DEVICE_OUT_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700184 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800185 SND_DEVICE_OUT_VOICE_HEADPHONES,
186 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
187 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700188};
189
190static const snd_device_t helicon_skuab_variant_devices[] = {
191 SND_DEVICE_OUT_SPEAKER,
192 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
193 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
Walter Yang1d50ce62014-02-21 11:12:58 +0800194 SND_DEVICE_OUT_VOICE_SPEAKER,
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700195};
196
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700197static const snd_device_t tasha_fluid_variant_devices[] = {
198 SND_DEVICE_OUT_SPEAKER,
199 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
200 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
201 SND_DEVICE_OUT_VOICE_SPEAKER,
202 SND_DEVICE_OUT_SPEAKER_AND_HDMI,
203 SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET,
204 SND_DEVICE_OUT_SPEAKER_PROTECTED,
205 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
206};
207
208static const snd_device_t tasha_liquid_variant_devices[] = {
209 SND_DEVICE_OUT_SPEAKER,
210 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
211 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
212 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
213 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
214 SND_DEVICE_IN_SPEAKER_MIC,
215 SND_DEVICE_IN_HEADSET_MIC,
216 SND_DEVICE_IN_VOICE_DMIC,
217 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
218 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
219 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
220 SND_DEVICE_IN_QUAD_MIC,
Aalique Grahame22e49102018-12-18 14:23:57 -0800221 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
222 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700223};
224
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500225
Xiaoyu Ye11380482017-07-19 16:47:59 -0700226static const snd_device_t tavil_qrd_variant_devices[] = {
Karthikeyan Mani1e8a4b72017-08-24 11:05:50 -0700227 SND_DEVICE_OUT_SPEAKER,
228 SND_DEVICE_OUT_VOICE_SPEAKER,
229 SND_DEVICE_OUT_HANDSET,
230 SND_DEVICE_OUT_VOICE_HANDSET,
231 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Xiaoyu Ye11380482017-07-19 16:47:59 -0700232};
233
Meng Wang91affea2018-06-04 15:16:26 +0800234static const snd_device_t tavil_qrd_msmnile_variant_devices[] = {
235 SND_DEVICE_OUT_SPEAKER,
236 SND_DEVICE_OUT_VOICE_SPEAKER,
237 SND_DEVICE_OUT_HANDSET,
238 SND_DEVICE_OUT_VOICE_HANDSET,
239 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Yunfei Zhangf1bba382018-09-28 19:15:16 +0800240 SND_DEVICE_IN_VOICE_HEADSET_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800241 SND_DEVICE_IN_HANDSET_MIC,
242 SND_DEVICE_IN_HANDSET_MIC_AEC,
243 SND_DEVICE_IN_HANDSET_MIC_NS,
244 SND_DEVICE_IN_HANDSET_MIC_AEC_NS,
Meng Wang91affea2018-06-04 15:16:26 +0800245 SND_DEVICE_IN_SPEAKER_MIC,
kunleiz9644b272018-06-12 18:14:26 +0800246 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
kunleiz4b4db4b2018-07-09 13:04:07 +0800247 SND_DEVICE_IN_SPEAKER_MIC_AEC,
248 SND_DEVICE_IN_SPEAKER_MIC_NS,
249 SND_DEVICE_IN_SPEAKER_MIC_AEC_NS,
kunleiz9644b272018-06-12 18:14:26 +0800250 SND_DEVICE_IN_VOICE_DMIC,
251 SND_DEVICE_IN_HANDSET_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800252 SND_DEVICE_IN_HANDSET_DMIC_NS,
253 SND_DEVICE_IN_HANDSET_DMIC_AEC,
254 SND_DEVICE_IN_HANDSET_DMIC_AEC_NS,
Aalique Grahame22e49102018-12-18 14:23:57 -0800255 SND_DEVICE_IN_HANDSET_DMIC_STEREO,
256 SND_DEVICE_IN_SPEAKER_DMIC_STEREO,
kunleiz9644b272018-06-12 18:14:26 +0800257 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
kunleiz27c14492018-11-05 15:04:49 +0800258 SND_DEVICE_IN_SPEAKER_DMIC_AEC,
259 SND_DEVICE_IN_SPEAKER_DMIC_NS,
260 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS,
kunleiz4b4db4b2018-07-09 13:04:07 +0800261 SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
262 SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
263 SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
264 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
kunleiz9644b272018-06-12 18:14:26 +0800265 SND_DEVICE_IN_THREE_MIC,
266 SND_DEVICE_IN_HANDSET_TMIC,
267 SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO,
268 SND_DEVICE_IN_HANDSET_TMIC_AEC,
269 SND_DEVICE_IN_HANDSET_TMIC_NS,
270 SND_DEVICE_IN_HANDSET_TMIC_AEC_NS,
271 SND_DEVICE_IN_VOICE_SPEAKER_TMIC,
272 SND_DEVICE_IN_SPEAKER_TMIC_AEC,
273 SND_DEVICE_IN_SPEAKER_TMIC_NS,
274 SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS,
275 SND_DEVICE_IN_QUAD_MIC,
276 SND_DEVICE_IN_HANDSET_QMIC,
277 SND_DEVICE_IN_SPEAKER_QMIC_AEC,
278 SND_DEVICE_IN_SPEAKER_QMIC_NS,
279 SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
280 SND_DEVICE_IN_VOICE_SPEAKER_QMIC,
281 SND_DEVICE_IN_AANC_HANDSET_MIC,
282 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
283 SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
Xiaojun Sangfa1db6f2018-07-10 16:35:23 +0800284 SND_DEVICE_OUT_SPEAKER_PROTECTED,
285 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
286 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED,
Meng Wang91affea2018-06-04 15:16:26 +0800287};
288
289
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500290static const snd_device_t auto_variant_devices[] = {
291 SND_DEVICE_OUT_SPEAKER
292};
293
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700294static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name)
295{
Helen Zeng6a16ad72014-02-23 22:04:44 -0800296 if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card") ||
297 !strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card",
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800298 sizeof("apq8084-taiko-i2s-mtp-snd-card")) ||
299 !strncmp(snd_card_name, "apq8084-tomtom-mtp-snd-card",
300 sizeof("apq8084-tomtom-mtp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700301 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
302 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
303 hw_info->snd_devices = NULL;
304 hw_info->num_snd_devices = 0;
305 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800306 } else if ((!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) ||
307 !strncmp(snd_card_name, "apq8084-tomtom-cdp-snd-card",
308 sizeof("apq8084-tomtom-cdp-snd-card"))) {
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700309 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
310 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800311 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_CDP_variant_devices;
312 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_CDP_variant_devices);
313 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Helen Zeng6a16ad72014-02-23 22:04:44 -0800314 } else if (!strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card",
315 sizeof("apq8084-taiko-i2s-cdp-snd-card"))) {
316 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
317 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
318 hw_info->snd_devices = NULL;
319 hw_info->num_snd_devices = 0;
320 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700321 } else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) {
322 strlcpy(hw_info->type , " liquid", sizeof(hw_info->type));
323 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type));
324 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
325 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
Banajit Goswamid60ca7f2013-11-16 20:55:49 -0800326 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel4594f752014-02-13 15:10:17 +0200327 } else if (!strcmp(snd_card_name, "apq8084-taiko-sbc-snd-card")) {
328 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
329 strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name));
330 hw_info->snd_devices = (snd_device_t *)taiko_apq8084_sbc_variant_devices;
331 hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_sbc_variant_devices);
332 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700333 } else {
334 ALOGW("%s: Not an 8084 device", __func__);
335 }
336}
337
Josh Kirschc3894372016-03-28 15:59:48 -0700338static void update_hardware_info_8096(struct hardware_info *hw_info, const char *snd_card_name)
339{
340 if (!strcmp(snd_card_name, "apq8096-tasha-i2c-snd-card")) {
341 ALOGW("%s: Updating hardware info for APQ 8096", __func__);
342 strlcpy(hw_info->type, "mtp", sizeof(hw_info->type));
343 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
344 hw_info->snd_devices = NULL;
345 hw_info->num_snd_devices = 0;
346 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Honghao Liu1ed0b4d2018-01-15 10:59:32 -0500347 } else if (!strcmp(snd_card_name, "apq8096-auto-snd-card")) {
348 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
349 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
350 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
351 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
352 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
353 } else if (!strcmp(snd_card_name, "apq8096-adp-agave-snd-card")) {
354 strlcpy(hw_info->type, " agave", sizeof(hw_info->type));
355 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
356 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
357 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
358 strlcpy(hw_info->dev_extn, "-agave", sizeof(hw_info->dev_extn));
359 } else if (!strcmp(snd_card_name, "apq8096-adp-mmxf-snd-card")) {
360 strlcpy(hw_info->type, " mmxf", sizeof(hw_info->type));
361 strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name));
362 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
363 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
364 strlcpy(hw_info->dev_extn, "-mmxf", sizeof(hw_info->dev_extn));
Josh Kirschc3894372016-03-28 15:59:48 -0700365 } else {
366 ALOGW("%s: Not an 8096 device", __func__);
367 }
368}
369
Mingming Yin0e1b2902014-05-19 18:20:59 -0700370static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name)
371{
372 if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) {
373 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
374 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
375 hw_info->snd_devices = NULL;
376 hw_info->num_snd_devices = 0;
377 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700378 } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700379 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
380 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
381 hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
382 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
383 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700384 } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700385 strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
386 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
387 hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
388 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
389 strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
Mingming Yine5575ab2014-05-23 11:00:34 -0700390 } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) {
Mingming Yin0e1b2902014-05-19 18:20:59 -0700391 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
392 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
393 hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
394 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices);
395 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkelca735962014-11-05 23:17:25 +0200396 } else if (!strcmp(snd_card_name, "msm8994-tomtom-db-snd-card")) {
397 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
398 strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
399 hw_info->snd_devices = (snd_device_t *)tomtom_DB_variant_devices;
400 hw_info->num_snd_devices = ARRAY_SIZE(tomtom_DB_variant_devices);
401 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Mingming Yin0e1b2902014-05-19 18:20:59 -0700402 } else {
403 ALOGW("%s: Not an 8994 device", __func__);
404 }
405}
406
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700407static void update_hardware_info_8996(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami22582e72014-10-15 18:29:34 -0700408{
Neema Shetty52a72c72015-08-26 12:26:06 -0700409 if (!strcmp(snd_card_name, "msm8996-tasha-fluid-snd-card")) {
Vidyakumar Athotae05c4802015-07-16 11:20:44 -0700410 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
411 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
412 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
413 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
414 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
415 } else if (!strcmp(snd_card_name, "msm8996-tasha-liquid-snd-card")) {
416 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
417 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
418 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
419 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
420 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Tanya Finkel2f96e842015-06-29 13:27:57 +0300421 } else if (!strcmp(snd_card_name, "msm8996-tasha-db-snd-card")) {
422 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
423 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
424 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
425 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
426 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
Anna Hanna Sedlak Grinbaumb19ec452016-08-01 17:32:23 +0300427 } else if (!strcmp(snd_card_name, "msm8996-tasha-sbc-snd-card")) {
428 strlcpy(hw_info->type, " sbc", sizeof(hw_info->type));
429 strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name));
430 hw_info->snd_devices = (snd_device_t *)tasha_sbc_variant_devices;
431 hw_info->num_snd_devices = ARRAY_SIZE(tasha_sbc_variant_devices);
432 strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn));
Banajit Goswami22582e72014-10-15 18:29:34 -0700433 } else {
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700434 ALOGW("%s: Not a 8996 device", __func__);
Banajit Goswami22582e72014-10-15 18:29:34 -0700435 }
436}
437
Ben Romberger22d41232016-11-16 14:55:25 -0800438static void update_hardware_info_msm8998(struct hardware_info *hw_info, const char *snd_card_name)
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800439{
Ben Romberger22d41232016-11-16 14:55:25 -0800440 if (!strcmp(snd_card_name, "msm8998-tasha-fluid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800441 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800442 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800443 hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices;
444 hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices);
Rohit kumard3c3b912016-11-15 18:50:31 +0530445 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800446 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800447 } else if (!strcmp(snd_card_name, "msm8998-tasha-liquid-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800448 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800449 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800450 hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices;
451 hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices);
452 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
Ben Romberger22d41232016-11-16 14:55:25 -0800453 } else if (!strcmp(snd_card_name, "msm8998-tasha-db-snd-card")) {
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800454 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
Ben Romberger22d41232016-11-16 14:55:25 -0800455 strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name));
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800456 hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices;
457 hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices);
458 strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn));
kunleizaa6a3f12017-01-19 12:28:28 +0800459 } else if (!strcmp(snd_card_name, "msm8998-qvr-tavil-snd-card")) {
460 hw_info->is_stereo_spkr = false;
461 } else if (!strcmp(snd_card_name, "msm8998-skuk-tavil-snd-card")) {
462 hw_info->is_stereo_spkr = false;
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800463 } else {
Ben Romberger22d41232016-11-16 14:55:25 -0800464 ALOGW("%s: Not a msm8998 device", __func__);
Banajit Goswami4c0dff22016-03-04 18:31:22 -0800465 }
466}
467
Xiaoyu Ye11380482017-07-19 16:47:59 -0700468static void update_hardware_info_sdm845(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700469{
Xiaoyu Ye11380482017-07-19 16:47:59 -0700470 if (!strcmp(snd_card_name, "sdm845-tavil-qrd-snd-card")) {
471 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
472 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
473 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
474 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
475 hw_info->is_stereo_spkr = false;
476 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Meng Wang69b865c2017-10-30 15:12:12 +0800477 } else if (!strcmp(snd_card_name, "sdm845-tavil-hdk-snd-card")) {
478 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
479 strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name));
480 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
481 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
482 hw_info->is_stereo_spkr = false;
483 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Meng Wang43a5e102017-11-01 10:49:01 +0800484 } else if (!strcmp(snd_card_name, "sdm845-qvr-tavil-snd-card")) {
485 hw_info->is_stereo_spkr = false;
Xiaoyu Ye11380482017-07-19 16:47:59 -0700486 } else {
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700487 ALOGW("%s: Not a sdm845 device", __func__);
Xiaoyu Ye11380482017-07-19 16:47:59 -0700488 }
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700489}
490
Meng Wang8e5dccc2018-03-05 15:52:24 +0800491static void update_hardware_info_msmnile(struct hardware_info *hw_info, const char *snd_card_name)
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800492{
Meng Wang8e5dccc2018-03-05 15:52:24 +0800493 if (strstr(snd_card_name, "qrd")) {
494 strlcpy(hw_info->type, " qrd", sizeof(hw_info->type));
495 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
Meng Wang91affea2018-06-04 15:16:26 +0800496 hw_info->snd_devices = (snd_device_t *)tavil_qrd_msmnile_variant_devices;
497 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_msmnile_variant_devices);
Meng Wang8e5dccc2018-03-05 15:52:24 +0800498 hw_info->is_stereo_spkr = false;
499 strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn));
Vidyakumar Athota460cc662018-04-01 21:05:57 -0700500 } else if (strstr(snd_card_name, "pahu")) {
501 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
502 hw_info->is_stereo_spkr = false;
Derek Chen4d6f7702018-07-07 14:04:27 -0700503 } else if (strstr(snd_card_name, "adp")) {
504 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
505 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
506 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
507 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
508 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
509 } else if (strstr(snd_card_name, "custom")) {
510 strlcpy(hw_info->type, "custom", sizeof(hw_info->type));
511 strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name));
512 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
513 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
514 strlcpy(hw_info->dev_extn, "-custom", sizeof(hw_info->dev_extn));
Meng Wang8e5dccc2018-03-05 15:52:24 +0800515 } else {
516 ALOGW("%s: Not a msmnile device", __func__);
517 }
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800518}
519
Meng Wangef2f6e12018-10-08 13:06:05 +0800520static void update_hardware_info_kona(
521 struct hardware_info *hw_info,
522 const char *snd_card_name)
523{
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800524 if (!strncmp(snd_card_name, "lito-lagoonmtp-snd-card",
525 sizeof("lito-lagoonmtp-snd-card"))) {
526 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
527 } else if (!strncmp(snd_card_name, "lito-lagoonqrd-snd-card",
528 sizeof("lito-lagoonqrd-snd-card"))) {
529 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
530 hw_info->is_stereo_spkr = false;
531 } else if (!strncmp(snd_card_name, "bengal-idp-snd-card",
Harshal Ahire46374152019-10-22 11:37:12 +0530532 sizeof("bengal-idp-snd-card"))) {
533 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
534 hw_info->is_stereo_spkr = false;
Aditya Bavanari05999be2020-03-12 20:12:32 +0530535 } else if (!strncmp(snd_card_name, "bengal-scubaidp-snd-card",
536 sizeof("bengal-scubaidp-snd-card"))) {
537 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
538 hw_info->is_stereo_spkr = false;
Harshal Ahire46374152019-10-22 11:37:12 +0530539 } else if (!strncmp(snd_card_name, "kona-mtp-snd-card",
Meng Wangef2f6e12018-10-08 13:06:05 +0800540 sizeof("kona-mtp-snd-card"))) {
541 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
Vatsal Bucha6339b092019-04-17 16:27:32 +0530542 } else if (!strncmp(snd_card_name, "lito-mtp-snd-card",
543 sizeof("lito-mtp-snd-card"))) {
544 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530545 } else if (!strncmp(snd_card_name, "atoll-idp-snd-card",
546 sizeof("atoll-idp-snd-card"))) {
547 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
548 } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card",
549 sizeof("atoll-wcd937x-snd-card"))) {
550 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
Kunlei Zhang47509fc2019-08-16 16:41:28 +0800551 } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card",
552 sizeof("atoll-qrd-snd-card"))) {
553 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
554 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800555 } else if (!strncmp(snd_card_name, "kona-qrd-snd-card",
556 sizeof("kona-qrd-snd-card"))) {
557 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
558 hw_info->is_stereo_spkr = false;
Vatsal Bucha6339b092019-04-17 16:27:32 +0530559 } else if (!strncmp(snd_card_name, "lito-qrd-snd-card",
560 sizeof("lito-qrd-snd-card"))) {
561 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
562 hw_info->is_stereo_spkr = false;
Kunlei Zhang57215122019-12-30 13:43:31 +0800563 } else if (!strncmp(snd_card_name, "bengal-qrd-snd-card",
564 sizeof("bengal-qrd-snd-card"))) {
565 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
566 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800567 } else {
568 ALOGW("%s: Not a kona device", __func__);
569 }
570}
571
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530572static void update_hardware_info_holi(
573 struct hardware_info *hw_info,
574 const char *snd_card_name)
575{
576 if (!strncmp(snd_card_name, "holi-mtp-snd-card",
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530577 sizeof("holi-mtp-snd-card")) ||
578 !strncmp(snd_card_name, "holi-qrd-snd-card",
579 sizeof("holi-qrd-snd-card")) ||
Amarnath Vangala2e663cf2020-09-22 23:15:15 +0530580 !strncmp(snd_card_name, "holi-usbc-snd-card",
581 sizeof("holi-usbc-snd-card")) ||
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530582 !strncmp(snd_card_name, "holi-qrdsku1-snd-card",
583 sizeof("holi-qrdsku1-snd-card")) ||
584 !strncmp(snd_card_name, "holi-mtpsku1-snd-card",
585 sizeof("holi-mtpsku1-snd-card"))) {
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530586 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530587 hw_info->is_stereo_spkr = false;
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530588 } else {
589 ALOGW("%s: Not a holi device", __func__);
590 }
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530591}
592
Aalique Grahame03b184e2020-02-07 23:24:57 -0800593static void update_hardware_info_lahaina(
594 struct hardware_info *hw_info,
595 const char *snd_card_name)
596{
597 if (!strncmp(snd_card_name, "lahaina-mtp-snd-card",
598 sizeof("lahaina-mtp-snd-card"))) {
599 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Kunlei Zhangf755aee2020-08-13 15:02:57 +0800600 hw_info->use_mono_spkr_for_qmic = true;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800601 } else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card",
602 sizeof("lahaina-qrd-snd-card"))) {
603 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
604 hw_info->is_stereo_spkr = true;
Meng Wang20405952020-05-19 09:57:28 +0800605 } else if (!strncmp(snd_card_name, "lahaina-cdp-snd-card",
606 sizeof("lahaina-cdp-snd-card"))) {
607 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Meng Wangc1c97392020-08-13 15:57:28 +0800608 } else if (!strncmp(snd_card_name, "lahaina-hdk-snd-card",
609 sizeof("lahaina-hdk-snd-card"))) {
610 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
611 hw_info->is_stereo_spkr = false;
Meng Wangae9a9b72020-12-25 14:26:10 +0800612 } else if (!strncmp(snd_card_name, "lahaina-hhg-snd-card",
613 sizeof("lahaina-hhg-snd-card"))) {
614 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
615 hw_info->is_stereo_spkr = true;
Faiz Nabi Kuchay1adff8f2020-07-21 11:25:11 +0530616 } else if (!strncmp(snd_card_name, "lahaina-shimaidp-snd-card",
617 sizeof("lahaina-shimaidp-snd-card"))) {
618 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
619 } else if (!strncmp(snd_card_name, "lahaina-shimaidps-snd-card",
620 sizeof("lahaina-shimaidps-snd-card"))) {
621 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
622 } else if (!strncmp(snd_card_name, "lahaina-shimaqrd-snd-card",
623 sizeof("lahaina-shimaqrd-snd-card"))) {
624 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
Xiaojun Sanga5197a92020-07-28 10:28:55 +0800625 hw_info->is_stereo_spkr = false;
Vatsal Bucha3a080c62020-11-27 22:23:12 +0530626 } else if (!strncmp(snd_card_name, "lahaina-yupikidp-snd-card",
627 sizeof("lahaina-yupikidp-snd-card"))) {
628 strlcpy(hw_info->name, "yupik", sizeof(hw_info->name));
629 } else if (!strncmp(snd_card_name, "lahaina-yupikqrd-snd-card",
630 sizeof("lahaina-yupikqrd-snd-card"))) {
631 strlcpy(hw_info->name, "yupik", sizeof(hw_info->name));
632 hw_info->is_stereo_spkr = false;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800633 } else {
634 ALOGW("%s: Not a lahaina device", __func__);
635 }
636}
637
Josh Kirschf20adbf2018-03-06 16:26:22 -0800638static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name)
639{
640 if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) {
641 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
642 strlcpy(hw_info->name, "sda845", sizeof(hw_info->name));
643 hw_info->snd_devices = NULL;
644 hw_info->num_snd_devices = 0;
645 hw_info->is_stereo_spkr = false;
646 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
647 } else {
648 ALOGW("%s: Not a sda845 device", __func__);
649 }
650}
651
Xiaoyu Yec494c752017-11-02 18:52:48 -0700652static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused)
653{
654 ALOGW("%s: Not a sdx device", __func__);
655}
656
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700657static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
658{
659 if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
660 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
661 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
662 hw_info->snd_devices = NULL;
663 hw_info->num_snd_devices = 0;
664 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
665 } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
666 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
667 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
668 hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
669 hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800670 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700671 } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
672 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
673 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
674 hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
675 hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
676 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
677 } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
678 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
679 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
680 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
681 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
682 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
683 } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
684 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
685 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
686 hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
687 hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
688 strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
689 } else {
690 ALOGW("%s: Not an 8974 device", __func__);
691 }
692}
693
694static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
695{
696 if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
697 strlcpy(hw_info->type, "", sizeof(hw_info->type));
698 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
699 hw_info->snd_devices = NULL;
700 hw_info->num_snd_devices = 0;
701 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
702 } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
703 strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
704 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
705 hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
706 hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
707 strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
708 } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
709 strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
710 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
711 hw_info->snd_devices = NULL;
712 hw_info->num_snd_devices = 0;
713 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
714 } else {
715 ALOGW("%s: Not an 8x10 device", __func__);
716 }
717}
718
719static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
720{
721 if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
722 strlcpy(hw_info->type, "", sizeof(hw_info->type));
723 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
724 hw_info->snd_devices = NULL;
725 hw_info->num_snd_devices = 0;
726 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
727 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
728 strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
729 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
730 hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
731 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
732 strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
733 } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
734 strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
735 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
736 hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
737 hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
738 strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
739 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
740 strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
741 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
742 hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
743 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
744 strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
745 } else {
746 ALOGW("%s: Not an 8x26 device", __func__);
747 }
748}
749
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530750static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name)
751{
Walter Yang319c6fe2017-09-21 17:09:39 +0800752 if (!strncmp(snd_card_name, "sdm660-snd-card",
Meng Wang923204f2018-05-21 18:32:41 +0800753 sizeof("sdm660-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530754 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530755 } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) {
756 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
757 } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) {
758 hw_info->is_stereo_spkr = false;
759 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
760 } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) {
761 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800762 } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card",
763 sizeof("qcs405-sku1-snd-card"))) {
Dhananjay Kumar75c9a0c2018-06-07 15:59:00 +0530764 strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800765 } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card",
766 sizeof("qcs605-lc-snd-card"))) {
Sachin Mohan Gadageffd7562018-02-13 17:10:09 +0530767 strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name));
yang liu9f4232d2018-09-18 20:51:11 +0800768 } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card",
769 sizeof("qcs605-ipc-tavil-snd-card"))) {
770 strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800771 } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card",
772 sizeof("sdm660-tavil-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530773 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800774 } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card",
775 sizeof("sdm670-skuw-snd-card"))) {
Walter Yang319c6fe2017-09-21 17:09:39 +0800776 hw_info->is_stereo_spkr = false;
Meng Wang923204f2018-05-21 18:32:41 +0800777 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
778 sizeof("sdm670-tavil-hdk-snd-card"))) {
779 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
780 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
781 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
782 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
783 hw_info->is_stereo_spkr = false;
784 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530785 } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card",
786 sizeof("sm6150-idp-snd-card"))) {
787 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Aditya Bavanari4dbceed2018-10-11 18:31:55 +0530788 } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card",
789 sizeof("sm6150-wcd9375-snd-card"))) {
790 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Xiaojun Sangfcddd672018-08-15 17:53:48 +0800791 } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card",
792 sizeof("sm6150-qrd-snd-card"))) {
793 hw_info->is_stereo_spkr = false;
794 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
kunleiz3ae92e52019-04-28 15:35:31 +0800795 } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card",
796 sizeof("sm6150-wcd9375qrd-snd-card"))) {
797 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
798 hw_info->is_stereo_spkr = false;
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530799 } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card",
800 sizeof("sm6150-tavil-snd-card"))) {
801 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530802 hw_info->is_stereo_spkr = false;
803 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
804 sizeof("sdm670-tavil-hdk-snd-card"))) {
805 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
806 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
807 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
808 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
809 hw_info->is_stereo_spkr = false;
810 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530811 } else if (!strncmp(snd_card_name, "trinket-idp-snd-card",
812 sizeof("trinket-idp-snd-card"))) {
813 hw_info->is_stereo_spkr = false;
814 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
815 } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card",
816 sizeof("trinket-tashalite-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530817 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
818 } else if (!strncmp(snd_card_name, "trinket-tasha-snd-card",
819 sizeof("trinket-tasha-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530820 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
821 } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card",
822 sizeof("trinket-tavil-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530823 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530824 } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card",
825 sizeof("sa6155-adp-star-snd-card"))) {
826 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
827 strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name));
828 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
829 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
830 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
Meng Wang923204f2018-05-21 18:32:41 +0800831 } else {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530832 ALOGW("%s: Not an SDM device", __func__);
Meng Wang923204f2018-05-21 18:32:41 +0800833 }
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530834}
835
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530836static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name)
837{
838 if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
839 hw_info->is_stereo_spkr = false;
840 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
841 } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
842 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
843 } else {
844 ALOGW("%s: Not an SDM439 device", __func__);
845 }
846}
847
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530848static void update_hardware_info_msm8937(struct hardware_info *hw_info, const char *snd_card_name)
849{
850 if (!strcmp(snd_card_name, "msm8937-snd-card-mtp")) {
851 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
852 } else if (!strcmp(snd_card_name, "msm8937-tasha-snd-card")) {
853 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
854 } else if (!strcmp(snd_card_name, "msm8937-tashalite-snd-card")) {
855 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
856 }
857}
858
859static void update_hardware_info_msm8953(struct hardware_info *hw_info, const char *snd_card_name)
860{
861 if (!strcmp(snd_card_name, "msm8953-snd-card-mtp")) {
862 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
863 } else if (!strcmp(snd_card_name, "msm8953-sku3-tasha-snd-card")) {
864 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
865 } else if (!strcmp(snd_card_name, "msm8953-tasha-snd-card")) {
866 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
867 } else if (!strcmp(snd_card_name, "msm8953-tashalite-snd-card")) {
868 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
869 } else if (!strcmp(snd_card_name, "msm8953-sku4-snd-card")) {
870 hw_info->is_stereo_spkr = false;
871 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
872 }
873}
874
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530875static void update_hardware_info_msm8952(struct hardware_info *hw_info, const char *snd_card_name)
876{
877 if (!strcmp(snd_card_name, "msm8952-snd-card")) {
878 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
879 } else if (!strcmp(snd_card_name, "msm8952-snd-card-mtp")) {
880 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
881 } else if (!strcmp(snd_card_name, "msm8952-tomtom-snd-card")) {
882 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
883 } else if (!strcmp(snd_card_name, "msm8952-tasha-snd-card")) {
884 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
885 } else if (!strcmp(snd_card_name, "msm8952-tashalite-snd-card")) {
886 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
887 } else if (!strcmp(snd_card_name, "msm8952-skum-snd-card")) {
888 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
889 } else if (!strcmp(snd_card_name, "msm8952-sku1-snd-card")) {
890 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
891 } else if (!strcmp(snd_card_name, "msm8952-sku2-snd-card")) {
892 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
893 } else if (!strcmp(snd_card_name, "msm8952-sku3-tasha-snd-card")) {
894 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
895 }
896}
897
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700898void *hw_info_init(const char *snd_card_name)
899{
900 struct hardware_info *hw_info;
901
902 hw_info = malloc(sizeof(struct hardware_info));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700903 if (!hw_info) {
904 ALOGE("failed to allocate mem for hardware info");
905 return NULL;
906 }
907
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800908 hw_info->snd_devices = NULL;
909 hw_info->num_snd_devices = 0;
Rohit kumard3c3b912016-11-15 18:50:31 +0530910 hw_info->is_stereo_spkr = true;
Kunlei Zhangf755aee2020-08-13 15:02:57 +0800911 hw_info->use_mono_spkr_for_qmic = false;
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530912 hw_info->is_wsa_combo_suppported = false;
Mingming Yin0e1b2902014-05-19 18:20:59 -0700913 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
914 strlcpy(hw_info->type, "", sizeof(hw_info->type));
915 strlcpy(hw_info->name, "", sizeof(hw_info->name));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700916
917 if(strstr(snd_card_name, "msm8974") ||
918 strstr(snd_card_name, "apq8074")) {
919 ALOGV("8974 - variant soundcard");
920 update_hardware_info_8974(hw_info, snd_card_name);
921 } else if(strstr(snd_card_name, "msm8226")) {
922 ALOGV("8x26 - variant soundcard");
923 update_hardware_info_8226(hw_info, snd_card_name);
924 } else if(strstr(snd_card_name, "msm8x10")) {
925 ALOGV("8x10 - variant soundcard");
926 update_hardware_info_8610(hw_info, snd_card_name);
927 } else if(strstr(snd_card_name, "apq8084")) {
928 ALOGV("8084 - variant soundcard");
929 update_hardware_info_8084(hw_info, snd_card_name);
Mingming Yin0e1b2902014-05-19 18:20:59 -0700930 } else if(strstr(snd_card_name, "msm8994")) {
931 ALOGV("8994 - variant soundcard");
932 update_hardware_info_8994(hw_info, snd_card_name);
Josh Kirschc3894372016-03-28 15:59:48 -0700933 } else if(strstr(snd_card_name, "apq8096")) {
934 ALOGV("8096 - variant soundcard");
935 update_hardware_info_8096(hw_info, snd_card_name);
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700936 } else if(strstr(snd_card_name, "msm8996")) {
937 ALOGV("8996 - variant soundcard");
938 update_hardware_info_8996(hw_info, snd_card_name);
Venkataraman Nerellapallib8689ec2017-05-04 11:55:29 +0530939 } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) {
Ben Romberger22d41232016-11-16 14:55:25 -0800940 ALOGV("MSM8998 - variant soundcard");
941 update_hardware_info_msm8998(hw_info, snd_card_name);
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700942 } else if(strstr(snd_card_name, "sdm845")) {
943 ALOGV("SDM845 - variant soundcard");
944 update_hardware_info_sdm845(hw_info, snd_card_name);
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530945 } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670")
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530946 || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc")
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530947 || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc")
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530948 || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530949 ALOGV("Bear - variant soundcard");
950 update_hardware_info_bear(hw_info, snd_card_name);
Walter Yang558e1132018-01-02 11:47:19 +0800951 } else if (strstr(snd_card_name, "sdx")) {
Xiaoyu Yec494c752017-11-02 18:52:48 -0700952 ALOGV("SDX - variant soundcard");
953 update_hardware_info_sdx(hw_info, snd_card_name);
Derek Chen4d6f7702018-07-07 14:04:27 -0700954 } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") ||
955 strstr(snd_card_name, "sa8155")) {
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800956 ALOGV("MSMNILE - variant soundcard");
957 update_hardware_info_msmnile(hw_info, snd_card_name);
Josh Kirschf20adbf2018-03-06 16:26:22 -0800958 } else if (strstr(snd_card_name, "sda845")) {
959 ALOGV("SDA845 - variant soundcard");
960 update_hardware_info_sda845(hw_info, snd_card_name);
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530961 } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito")
Harshal Ahire46374152019-10-22 11:37:12 +0530962 || strstr(snd_card_name, "atoll") || strstr(snd_card_name, "bengal")) {
Meng Wangef2f6e12018-10-08 13:06:05 +0800963 ALOGV("KONA - variant soundcard");
964 update_hardware_info_kona(hw_info, snd_card_name);
Vatsal Bucha3a080c62020-11-27 22:23:12 +0530965 } else if(strstr(snd_card_name, "lahaina") || strstr(snd_card_name, "shima")
966 || strstr(snd_card_name, "yupik")) {
Aalique Grahame03b184e2020-02-07 23:24:57 -0800967 ALOGV("LAHAINA - variant soundcard");
968 update_hardware_info_lahaina(hw_info, snd_card_name);
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530969 } else if(strstr(snd_card_name, "holi")) {
970 ALOGV("HOLI - variant soundcard");
971 update_hardware_info_holi(hw_info, snd_card_name);
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530972 } else if(strstr(snd_card_name, "sdm439")) {
973 ALOGV("SDM439 - variant soundcard");
974 update_hardware_info_sdm439(hw_info, snd_card_name);
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530975 } else if (strstr(snd_card_name, "msm8937")) {
976 ALOGV("MSM8937 - variant soundcard");
977 update_hardware_info_msm8937(hw_info, snd_card_name);
978 } else if (strstr(snd_card_name, "msm8953")) {
979 ALOGV("MSM8953 - variant soundcard");
980 update_hardware_info_msm8953(hw_info, snd_card_name);
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530981 } else if (strstr(snd_card_name, "msm8952")) {
982 ALOGV("MSM8952 - variant soundcard");
983 update_hardware_info_msm8952(hw_info, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700984 } else {
Mingming Yin834543b2013-12-30 15:52:43 -0800985 ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700986 free(hw_info);
987 hw_info = NULL;
988 }
989
990 return hw_info;
991}
992
993void hw_info_deinit(void *hw_info)
994{
995 struct hardware_info *my_data = (struct hardware_info*) hw_info;
996
997 if(!my_data)
998 free(my_data);
999}
1000
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301001void hw_info_enable_wsa_combo_usecase_support(void *hw_info)
1002{
1003 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1004 if(!my_data) {
1005 ALOGE(" ERROR wsa combo update is called with invalid hw_info");
1006 return;
1007 }
1008 my_data->is_wsa_combo_suppported = true;
1009
1010}
1011
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001012void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
1013 char *device_name)
1014{
1015 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1016 uint32_t i = 0;
1017
1018 snd_device_t *snd_devices =
1019 (snd_device_t *) my_data->snd_devices;
1020
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301021
1022 if(my_data->is_wsa_combo_suppported) {
1023 for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) {
1024 if (snd_device == (snd_device_t)wsa_combo_devices[i]) {
1025 char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0};
1026 ALOGD("appending wsa extension to device %s",
1027 device_name);
1028 strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION,
1029 sizeof(WSA_MIXER_PATH_EXTENSION)) ;
1030 strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE);
1031 strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1);
1032 break;
1033 }
1034 }
1035 }
1036
1037
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001038 if(snd_devices != NULL) {
1039 for (i = 0; i < my_data->num_snd_devices; i++) {
1040 if (snd_device == (snd_device_t)snd_devices[i]) {
1041 ALOGV("extract dev_extn device %d, extn = %s",
1042 (snd_device_t)snd_devices[i], my_data->dev_extn);
1043 CHECK(strlcat(device_name, my_data->dev_extn,
1044 DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
1045 break;
1046 }
1047 }
1048 }
1049 ALOGD("%s : device_name = %s", __func__,device_name);
1050}
Rohit kumard3c3b912016-11-15 18:50:31 +05301051
1052bool hw_info_is_stereo_spkr(void *hw_info)
1053{
1054 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1055
1056 return my_data->is_stereo_spkr;
1057}
Kunlei Zhangf755aee2020-08-13 15:02:57 +08001058
1059bool hw_info_use_mono_spkr_for_qmic(void *hw_info)
1060{
1061 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1062
1063 return my_data->use_mono_spkr_for_qmic;
1064}