blob: 819ae1d5cea7bed7c531dc14024391ddf4ac83a1 [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;
Subhadra Jagadeesan38ebdca2020-09-09 16:59:43 +0530531 } else if (!strncmp(snd_card_name, "lito-orchidmtp-snd-card",
532 sizeof("lito-orchidmtp-snd-card"))) {
533 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Kunlei Zhangb5ff3d62020-02-19 14:18:47 +0800534 } else if (!strncmp(snd_card_name, "bengal-idp-snd-card",
Harshal Ahire46374152019-10-22 11:37:12 +0530535 sizeof("bengal-idp-snd-card"))) {
536 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
537 hw_info->is_stereo_spkr = false;
Aditya Bavanari05999be2020-03-12 20:12:32 +0530538 } else if (!strncmp(snd_card_name, "bengal-scubaidp-snd-card",
539 sizeof("bengal-scubaidp-snd-card"))) {
540 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
541 hw_info->is_stereo_spkr = false;
Harshal Ahire46374152019-10-22 11:37:12 +0530542 } else if (!strncmp(snd_card_name, "kona-mtp-snd-card",
Meng Wangef2f6e12018-10-08 13:06:05 +0800543 sizeof("kona-mtp-snd-card"))) {
544 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
Vatsal Bucha6339b092019-04-17 16:27:32 +0530545 } else if (!strncmp(snd_card_name, "lito-mtp-snd-card",
546 sizeof("lito-mtp-snd-card"))) {
547 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530548 } else if (!strncmp(snd_card_name, "atoll-idp-snd-card",
549 sizeof("atoll-idp-snd-card"))) {
550 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
551 } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card",
552 sizeof("atoll-wcd937x-snd-card"))) {
553 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
Kunlei Zhang47509fc2019-08-16 16:41:28 +0800554 } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card",
555 sizeof("atoll-qrd-snd-card"))) {
556 strlcpy(hw_info->name, "atoll", sizeof(hw_info->name));
557 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800558 } else if (!strncmp(snd_card_name, "kona-qrd-snd-card",
559 sizeof("kona-qrd-snd-card"))) {
560 strlcpy(hw_info->name, "kona", sizeof(hw_info->name));
561 hw_info->is_stereo_spkr = false;
Vatsal Bucha6339b092019-04-17 16:27:32 +0530562 } else if (!strncmp(snd_card_name, "lito-qrd-snd-card",
563 sizeof("lito-qrd-snd-card"))) {
564 strlcpy(hw_info->name, "lito", sizeof(hw_info->name));
565 hw_info->is_stereo_spkr = false;
Kunlei Zhang57215122019-12-30 13:43:31 +0800566 } else if (!strncmp(snd_card_name, "bengal-qrd-snd-card",
567 sizeof("bengal-qrd-snd-card"))) {
568 strlcpy(hw_info->name, "bengal", sizeof(hw_info->name));
569 hw_info->is_stereo_spkr = false;
Meng Wangef2f6e12018-10-08 13:06:05 +0800570 } else {
571 ALOGW("%s: Not a kona device", __func__);
572 }
573}
574
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530575static void update_hardware_info_holi(
576 struct hardware_info *hw_info,
577 const char *snd_card_name)
578{
579 if (!strncmp(snd_card_name, "holi-mtp-snd-card",
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530580 sizeof("holi-mtp-snd-card")) ||
581 !strncmp(snd_card_name, "holi-qrd-snd-card",
582 sizeof("holi-qrd-snd-card")) ||
Amarnath Vangala2e663cf2020-09-22 23:15:15 +0530583 !strncmp(snd_card_name, "holi-usbc-snd-card",
584 sizeof("holi-usbc-snd-card")) ||
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530585 !strncmp(snd_card_name, "holi-qrdsku1-snd-card",
586 sizeof("holi-qrdsku1-snd-card")) ||
587 !strncmp(snd_card_name, "holi-mtpsku1-snd-card",
588 sizeof("holi-mtpsku1-snd-card"))) {
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530589 strlcpy(hw_info->name, "holi", sizeof(hw_info->name));
Harshal Ahire5561b7e2020-09-02 12:14:34 +0530590 hw_info->is_stereo_spkr = false;
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530591 } else {
592 ALOGW("%s: Not a holi device", __func__);
593 }
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530594}
595
Aalique Grahame03b184e2020-02-07 23:24:57 -0800596static void update_hardware_info_lahaina(
597 struct hardware_info *hw_info,
598 const char *snd_card_name)
599{
600 if (!strncmp(snd_card_name, "lahaina-mtp-snd-card",
601 sizeof("lahaina-mtp-snd-card"))) {
602 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Kunlei Zhangf755aee2020-08-13 15:02:57 +0800603 hw_info->use_mono_spkr_for_qmic = true;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800604 } else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card",
605 sizeof("lahaina-qrd-snd-card"))) {
606 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
607 hw_info->is_stereo_spkr = true;
Meng Wang20405952020-05-19 09:57:28 +0800608 } else if (!strncmp(snd_card_name, "lahaina-cdp-snd-card",
609 sizeof("lahaina-cdp-snd-card"))) {
610 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
Meng Wangc1c97392020-08-13 15:57:28 +0800611 } else if (!strncmp(snd_card_name, "lahaina-hdk-snd-card",
612 sizeof("lahaina-hdk-snd-card"))) {
613 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
614 hw_info->is_stereo_spkr = false;
Meng Wangae9a9b72020-12-25 14:26:10 +0800615 } else if (!strncmp(snd_card_name, "lahaina-hhg-snd-card",
616 sizeof("lahaina-hhg-snd-card"))) {
617 strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
618 hw_info->is_stereo_spkr = true;
Faiz Nabi Kuchay1adff8f2020-07-21 11:25:11 +0530619 } else if (!strncmp(snd_card_name, "lahaina-shimaidp-snd-card",
620 sizeof("lahaina-shimaidp-snd-card"))) {
621 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
622 } else if (!strncmp(snd_card_name, "lahaina-shimaidps-snd-card",
623 sizeof("lahaina-shimaidps-snd-card"))) {
624 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
625 } else if (!strncmp(snd_card_name, "lahaina-shimaqrd-snd-card",
626 sizeof("lahaina-shimaqrd-snd-card"))) {
627 strlcpy(hw_info->name, "shima", sizeof(hw_info->name));
Xiaojun Sanga5197a92020-07-28 10:28:55 +0800628 hw_info->is_stereo_spkr = false;
Vatsal Bucha3a080c62020-11-27 22:23:12 +0530629 } else if (!strncmp(snd_card_name, "lahaina-yupikidp-snd-card",
630 sizeof("lahaina-yupikidp-snd-card"))) {
631 strlcpy(hw_info->name, "yupik", sizeof(hw_info->name));
632 } else if (!strncmp(snd_card_name, "lahaina-yupikqrd-snd-card",
633 sizeof("lahaina-yupikqrd-snd-card"))) {
634 strlcpy(hw_info->name, "yupik", sizeof(hw_info->name));
635 hw_info->is_stereo_spkr = false;
Aalique Grahame03b184e2020-02-07 23:24:57 -0800636 } else {
637 ALOGW("%s: Not a lahaina device", __func__);
638 }
639}
640
Josh Kirschf20adbf2018-03-06 16:26:22 -0800641static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name)
642{
643 if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) {
644 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
645 strlcpy(hw_info->name, "sda845", sizeof(hw_info->name));
646 hw_info->snd_devices = NULL;
647 hw_info->num_snd_devices = 0;
648 hw_info->is_stereo_spkr = false;
649 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
650 } else {
651 ALOGW("%s: Not a sda845 device", __func__);
652 }
653}
654
Xiaoyu Yec494c752017-11-02 18:52:48 -0700655static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused)
656{
657 ALOGW("%s: Not a sdx device", __func__);
658}
659
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700660static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name)
661{
662 if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) {
663 strlcpy(hw_info->type, " mtp", sizeof(hw_info->type));
664 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
665 hw_info->snd_devices = NULL;
666 hw_info->num_snd_devices = 0;
667 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
668 } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) {
669 strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
670 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
671 hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices;
672 hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices);
Krishnankutty Kolathappillyd801ae32013-11-03 15:48:42 -0800673 strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700674 } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) {
675 strlcpy(hw_info->type, " fluid", sizeof(hw_info->type));
676 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
677 hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices;
678 hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices);
679 strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn));
680 } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) {
681 strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
682 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
683 hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices;
684 hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices);
685 strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn));
686 } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) {
687 strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type));
688 strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name));
689 hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices;
690 hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices);
691 strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn));
692 } else {
693 ALOGW("%s: Not an 8974 device", __func__);
694 }
695}
696
697static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name)
698{
699 if (!strcmp(snd_card_name, "msm8x10-snd-card")) {
700 strlcpy(hw_info->type, "", sizeof(hw_info->type));
701 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
702 hw_info->snd_devices = NULL;
703 hw_info->num_snd_devices = 0;
704 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
705 } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) {
706 strlcpy(hw_info->type, "skuab", sizeof(hw_info->type));
707 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
708 hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices;
709 hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices);
710 strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn));
711 } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) {
712 strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type));
713 strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name));
714 hw_info->snd_devices = NULL;
715 hw_info->num_snd_devices = 0;
716 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
717 } else {
718 ALOGW("%s: Not an 8x10 device", __func__);
719 }
720}
721
722static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name)
723{
724 if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) {
725 strlcpy(hw_info->type, "", sizeof(hw_info->type));
726 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
727 hw_info->snd_devices = NULL;
728 hw_info->num_snd_devices = 0;
729 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
730 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) {
731 strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type));
732 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
733 hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices;
734 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices);
735 strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn));
736 } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) {
737 strlcpy(hw_info->type, " skuf", sizeof(hw_info->type));
738 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
739 hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices;
740 hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices);
741 strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn));
742 } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) {
743 strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type));
744 strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name));
745 hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices;
746 hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices);
747 strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn));
748 } else {
749 ALOGW("%s: Not an 8x26 device", __func__);
750 }
751}
752
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530753static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name)
754{
Walter Yang319c6fe2017-09-21 17:09:39 +0800755 if (!strncmp(snd_card_name, "sdm660-snd-card",
Meng Wang923204f2018-05-21 18:32:41 +0800756 sizeof("sdm660-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530757 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530758 } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) {
759 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
760 } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) {
761 hw_info->is_stereo_spkr = false;
762 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
763 } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) {
764 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800765 } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card",
766 sizeof("qcs405-sku1-snd-card"))) {
Dhananjay Kumar75c9a0c2018-06-07 15:59:00 +0530767 strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name));
Meng Wangc2219262018-05-21 18:32:41 +0800768 } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card",
769 sizeof("qcs605-lc-snd-card"))) {
Sachin Mohan Gadageffd7562018-02-13 17:10:09 +0530770 strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name));
yang liu9f4232d2018-09-18 20:51:11 +0800771 } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card",
772 sizeof("qcs605-ipc-tavil-snd-card"))) {
773 strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800774 } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card",
775 sizeof("sdm660-tavil-snd-card"))) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530776 strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name));
Meng Wang923204f2018-05-21 18:32:41 +0800777 } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card",
778 sizeof("sdm670-skuw-snd-card"))) {
Walter Yang319c6fe2017-09-21 17:09:39 +0800779 hw_info->is_stereo_spkr = false;
Meng Wang923204f2018-05-21 18:32:41 +0800780 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
781 sizeof("sdm670-tavil-hdk-snd-card"))) {
782 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
783 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
784 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
785 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
786 hw_info->is_stereo_spkr = false;
787 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530788 } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card",
789 sizeof("sm6150-idp-snd-card"))) {
790 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Aditya Bavanari4dbceed2018-10-11 18:31:55 +0530791 } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card",
792 sizeof("sm6150-wcd9375-snd-card"))) {
793 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Xiaojun Sangfcddd672018-08-15 17:53:48 +0800794 } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card",
795 sizeof("sm6150-qrd-snd-card"))) {
796 hw_info->is_stereo_spkr = false;
797 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
kunleiz3ae92e52019-04-28 15:35:31 +0800798 } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card",
799 sizeof("sm6150-wcd9375qrd-snd-card"))) {
800 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
801 hw_info->is_stereo_spkr = false;
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530802 } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card",
803 sizeof("sm6150-tavil-snd-card"))) {
804 strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name));
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530805 hw_info->is_stereo_spkr = false;
806 } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card",
807 sizeof("sdm670-tavil-hdk-snd-card"))) {
808 strlcpy(hw_info->type, " hdk", sizeof(hw_info->type));
809 strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name));
810 hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices;
811 hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices);
812 hw_info->is_stereo_spkr = false;
813 strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn));
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530814 } else if (!strncmp(snd_card_name, "trinket-idp-snd-card",
815 sizeof("trinket-idp-snd-card"))) {
816 hw_info->is_stereo_spkr = false;
817 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
818 } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card",
819 sizeof("trinket-tashalite-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-tasha-snd-card",
822 sizeof("trinket-tasha-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530823 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
824 } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card",
825 sizeof("trinket-tavil-snd-card"))) {
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530826 strlcpy(hw_info->name, "trinket", sizeof(hw_info->name));
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530827 } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card",
828 sizeof("sa6155-adp-star-snd-card"))) {
829 strlcpy(hw_info->type, "adp", sizeof(hw_info->type));
830 strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name));
831 hw_info->snd_devices = (snd_device_t *)auto_variant_devices;
832 hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices);
833 strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn));
Meng Wang923204f2018-05-21 18:32:41 +0800834 } else {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530835 ALOGW("%s: Not an SDM device", __func__);
Meng Wang923204f2018-05-21 18:32:41 +0800836 }
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530837}
838
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530839static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name)
840{
841 if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
842 hw_info->is_stereo_spkr = false;
843 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
844 } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
845 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
sriram kumarf592aa52020-12-10 17:56:56 +0530846 /* Wearbles LW and LAW uses different sound card name on sdm429w
847 so use strstr instead of strcmp to make it generic */
848 } else if (strstr(snd_card_name, "sdm429w")) {
849 strlcpy(hw_info->name, "sdm429w", sizeof(hw_info->name));
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530850 } else {
851 ALOGW("%s: Not an SDM439 device", __func__);
852 }
853}
854
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530855static void update_hardware_info_msm8937(struct hardware_info *hw_info, const char *snd_card_name)
856{
857 if (!strcmp(snd_card_name, "msm8937-snd-card-mtp")) {
858 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
859 } else if (!strcmp(snd_card_name, "msm8937-tasha-snd-card")) {
860 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
861 } else if (!strcmp(snd_card_name, "msm8937-tashalite-snd-card")) {
862 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
863 }
864}
865
866static void update_hardware_info_msm8953(struct hardware_info *hw_info, const char *snd_card_name)
867{
868 if (!strcmp(snd_card_name, "msm8953-snd-card-mtp")) {
869 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
870 } else if (!strcmp(snd_card_name, "msm8953-sku3-tasha-snd-card")) {
871 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
872 } else if (!strcmp(snd_card_name, "msm8953-tasha-snd-card")) {
873 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
874 } else if (!strcmp(snd_card_name, "msm8953-tashalite-snd-card")) {
875 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
876 } else if (!strcmp(snd_card_name, "msm8953-sku4-snd-card")) {
877 hw_info->is_stereo_spkr = false;
878 strlcpy(hw_info->name, "msm8953", sizeof(hw_info->name));
879 }
880}
881
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530882static void update_hardware_info_msm8952(struct hardware_info *hw_info, const char *snd_card_name)
883{
884 if (!strcmp(snd_card_name, "msm8952-snd-card")) {
885 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
886 } else if (!strcmp(snd_card_name, "msm8952-snd-card-mtp")) {
887 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
888 } else if (!strcmp(snd_card_name, "msm8952-tomtom-snd-card")) {
889 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
890 } else if (!strcmp(snd_card_name, "msm8952-tasha-snd-card")) {
891 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
892 } else if (!strcmp(snd_card_name, "msm8952-tashalite-snd-card")) {
893 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
894 } else if (!strcmp(snd_card_name, "msm8952-skum-snd-card")) {
895 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
896 } else if (!strcmp(snd_card_name, "msm8952-sku1-snd-card")) {
897 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
898 } else if (!strcmp(snd_card_name, "msm8952-sku2-snd-card")) {
899 strlcpy(hw_info->name, "msm8937", sizeof(hw_info->name));
900 } else if (!strcmp(snd_card_name, "msm8952-sku3-tasha-snd-card")) {
901 strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
902 }
903}
904
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700905void *hw_info_init(const char *snd_card_name)
906{
907 struct hardware_info *hw_info;
908
909 hw_info = malloc(sizeof(struct hardware_info));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700910 if (!hw_info) {
911 ALOGE("failed to allocate mem for hardware info");
912 return NULL;
913 }
914
Vidyakumar Athotab4dbbbe2014-03-06 14:34:40 -0800915 hw_info->snd_devices = NULL;
916 hw_info->num_snd_devices = 0;
Rohit kumard3c3b912016-11-15 18:50:31 +0530917 hw_info->is_stereo_spkr = true;
Kunlei Zhangf755aee2020-08-13 15:02:57 +0800918 hw_info->use_mono_spkr_for_qmic = false;
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530919 hw_info->is_wsa_combo_suppported = false;
Mingming Yin0e1b2902014-05-19 18:20:59 -0700920 strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
921 strlcpy(hw_info->type, "", sizeof(hw_info->type));
922 strlcpy(hw_info->name, "", sizeof(hw_info->name));
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700923
924 if(strstr(snd_card_name, "msm8974") ||
925 strstr(snd_card_name, "apq8074")) {
926 ALOGV("8974 - variant soundcard");
927 update_hardware_info_8974(hw_info, snd_card_name);
928 } else if(strstr(snd_card_name, "msm8226")) {
929 ALOGV("8x26 - variant soundcard");
930 update_hardware_info_8226(hw_info, snd_card_name);
931 } else if(strstr(snd_card_name, "msm8x10")) {
932 ALOGV("8x10 - variant soundcard");
933 update_hardware_info_8610(hw_info, snd_card_name);
934 } else if(strstr(snd_card_name, "apq8084")) {
935 ALOGV("8084 - variant soundcard");
936 update_hardware_info_8084(hw_info, snd_card_name);
Mingming Yin0e1b2902014-05-19 18:20:59 -0700937 } else if(strstr(snd_card_name, "msm8994")) {
938 ALOGV("8994 - variant soundcard");
939 update_hardware_info_8994(hw_info, snd_card_name);
Josh Kirschc3894372016-03-28 15:59:48 -0700940 } else if(strstr(snd_card_name, "apq8096")) {
941 ALOGV("8096 - variant soundcard");
942 update_hardware_info_8096(hw_info, snd_card_name);
Mingming Yin89c6a7f2015-03-24 11:56:14 -0700943 } else if(strstr(snd_card_name, "msm8996")) {
944 ALOGV("8996 - variant soundcard");
945 update_hardware_info_8996(hw_info, snd_card_name);
Venkataraman Nerellapallib8689ec2017-05-04 11:55:29 +0530946 } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) {
Ben Romberger22d41232016-11-16 14:55:25 -0800947 ALOGV("MSM8998 - variant soundcard");
948 update_hardware_info_msm8998(hw_info, snd_card_name);
Xiaoyu Ye0afc9232017-03-28 21:31:22 -0700949 } else if(strstr(snd_card_name, "sdm845")) {
950 ALOGV("SDM845 - variant soundcard");
951 update_hardware_info_sdm845(hw_info, snd_card_name);
Naresh Tanniruc21e2022018-08-13 21:58:06 +0530952 } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670")
Naresh Tannirucb5b5782018-10-12 20:42:07 +0530953 || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc")
Aditya Bavanari3c8e3572018-12-18 16:44:16 +0530954 || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc")
Rahul Sharma093a4ad2018-12-26 16:53:51 +0530955 || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) {
Preetam Singh Ranawatd770a362017-05-24 19:07:15 +0530956 ALOGV("Bear - variant soundcard");
957 update_hardware_info_bear(hw_info, snd_card_name);
Walter Yang558e1132018-01-02 11:47:19 +0800958 } else if (strstr(snd_card_name, "sdx")) {
Xiaoyu Yec494c752017-11-02 18:52:48 -0700959 ALOGV("SDX - variant soundcard");
960 update_hardware_info_sdx(hw_info, snd_card_name);
Derek Chen4d6f7702018-07-07 14:04:27 -0700961 } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") ||
962 strstr(snd_card_name, "sa8155")) {
Xiaoyu Ye91553e62017-11-21 17:35:50 -0800963 ALOGV("MSMNILE - variant soundcard");
964 update_hardware_info_msmnile(hw_info, snd_card_name);
Josh Kirschf20adbf2018-03-06 16:26:22 -0800965 } else if (strstr(snd_card_name, "sda845")) {
966 ALOGV("SDA845 - variant soundcard");
967 update_hardware_info_sda845(hw_info, snd_card_name);
Faiz Nabi Kuchay0b79d7d2019-08-05 20:36:31 +0530968 } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito")
Harshal Ahire46374152019-10-22 11:37:12 +0530969 || strstr(snd_card_name, "atoll") || strstr(snd_card_name, "bengal")) {
Meng Wangef2f6e12018-10-08 13:06:05 +0800970 ALOGV("KONA - variant soundcard");
971 update_hardware_info_kona(hw_info, snd_card_name);
Vatsal Bucha3a080c62020-11-27 22:23:12 +0530972 } else if(strstr(snd_card_name, "lahaina") || strstr(snd_card_name, "shima")
973 || strstr(snd_card_name, "yupik")) {
Aalique Grahame03b184e2020-02-07 23:24:57 -0800974 ALOGV("LAHAINA - variant soundcard");
975 update_hardware_info_lahaina(hw_info, snd_card_name);
Faiz Nabi Kuchay59d670c2020-07-17 21:22:08 +0530976 } else if(strstr(snd_card_name, "holi")) {
977 ALOGV("HOLI - variant soundcard");
978 update_hardware_info_holi(hw_info, snd_card_name);
sriram kumarf592aa52020-12-10 17:56:56 +0530979 } else if(strstr(snd_card_name, "sdm439") || strstr(snd_card_name, "sdm429w")) {
Sujin Panickerb904fbe2019-04-04 13:28:07 +0530980 ALOGV("SDM439 - variant soundcard");
981 update_hardware_info_sdm439(hw_info, snd_card_name);
Sujin Panickerd53dd1b2019-12-23 18:56:54 +0530982 } else if (strstr(snd_card_name, "msm8937")) {
983 ALOGV("MSM8937 - variant soundcard");
984 update_hardware_info_msm8937(hw_info, snd_card_name);
985 } else if (strstr(snd_card_name, "msm8953")) {
986 ALOGV("MSM8953 - variant soundcard");
987 update_hardware_info_msm8953(hw_info, snd_card_name);
Sujin Panicker7d87ceb2020-06-18 17:56:51 +0530988 } else if (strstr(snd_card_name, "msm8952")) {
989 ALOGV("MSM8952 - variant soundcard");
990 update_hardware_info_msm8952(hw_info, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700991 } else {
Mingming Yin834543b2013-12-30 15:52:43 -0800992 ALOGE("%s: Unsupported target %s:",__func__, snd_card_name);
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700993 free(hw_info);
994 hw_info = NULL;
995 }
996
997 return hw_info;
998}
999
1000void hw_info_deinit(void *hw_info)
1001{
1002 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1003
1004 if(!my_data)
1005 free(my_data);
1006}
1007
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301008void hw_info_enable_wsa_combo_usecase_support(void *hw_info)
1009{
1010 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1011 if(!my_data) {
1012 ALOGE(" ERROR wsa combo update is called with invalid hw_info");
1013 return;
1014 }
1015 my_data->is_wsa_combo_suppported = true;
1016
1017}
1018
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001019void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
1020 char *device_name)
1021{
1022 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1023 uint32_t i = 0;
1024
1025 snd_device_t *snd_devices =
1026 (snd_device_t *) my_data->snd_devices;
1027
Sujin Panickerb904fbe2019-04-04 13:28:07 +05301028
1029 if(my_data->is_wsa_combo_suppported) {
1030 for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) {
1031 if (snd_device == (snd_device_t)wsa_combo_devices[i]) {
1032 char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0};
1033 ALOGD("appending wsa extension to device %s",
1034 device_name);
1035 strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION,
1036 sizeof(WSA_MIXER_PATH_EXTENSION)) ;
1037 strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE);
1038 strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1);
1039 break;
1040 }
1041 }
1042 }
1043
1044
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -07001045 if(snd_devices != NULL) {
1046 for (i = 0; i < my_data->num_snd_devices; i++) {
1047 if (snd_device == (snd_device_t)snd_devices[i]) {
1048 ALOGV("extract dev_extn device %d, extn = %s",
1049 (snd_device_t)snd_devices[i], my_data->dev_extn);
1050 CHECK(strlcat(device_name, my_data->dev_extn,
1051 DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE);
1052 break;
1053 }
1054 }
1055 }
1056 ALOGD("%s : device_name = %s", __func__,device_name);
1057}
Rohit kumard3c3b912016-11-15 18:50:31 +05301058
1059bool hw_info_is_stereo_spkr(void *hw_info)
1060{
1061 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1062
1063 return my_data->is_stereo_spkr;
1064}
Kunlei Zhangf755aee2020-08-13 15:02:57 +08001065
1066bool hw_info_use_mono_spkr_for_qmic(void *hw_info)
1067{
1068 struct hardware_info *my_data = (struct hardware_info*) hw_info;
1069
1070 return my_data->use_mono_spkr_for_qmic;
1071}