Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 1 | /* |
Aalique Grahame | 22e4910 | 2018-12-18 14:23:57 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 3 | * |
| 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 Grahame | 22e4910 | 2018-12-18 14:23:57 -0800 | [diff] [blame] | 36 | #include <log/log.h> |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 37 | #include <cutils/str_parms.h> |
| 38 | #include "audio_hw.h" |
| 39 | #include "platform.h" |
| 40 | #include "platform_api.h" |
| 41 | |
Revathi Uddaraju | 1eac8b0 | 2017-05-18 17:13:33 +0530 | [diff] [blame] | 42 | #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 Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 47 | |
| 48 | struct 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 Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 55 | bool is_wsa_combo_suppported; |
Rohit kumar | d3c3b91 | 2016-11-15 18:50:31 +0530 | [diff] [blame] | 56 | bool is_stereo_spkr; |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 60 | #define WSA_MIXER_PATH_EXTENSION "wsa-" |
| 61 | |
| 62 | static const snd_device_t wsa_combo_devices[] = { |
| 63 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 64 | SND_DEVICE_OUT_SPEAKER_AND_LINE, |
| 65 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1, |
| 66 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2, |
Ramlal Karra | ab51d04 | 2019-08-08 19:02:35 +0530 | [diff] [blame] | 67 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 68 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_HIFI_FILTER |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 69 | }; |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 70 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 71 | static const snd_device_t taiko_fluid_variant_devices[] = { |
| 72 | SND_DEVICE_OUT_SPEAKER, |
| 73 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 74 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 75 | }; |
| 76 | |
| 77 | static const snd_device_t taiko_CDP_variant_devices[] = { |
| 78 | SND_DEVICE_OUT_SPEAKER, |
| 79 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 80 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 81 | SND_DEVICE_IN_QUAD_MIC, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
Banajit Goswami | d60ca7f | 2013-11-16 20:55:49 -0800 | [diff] [blame] | 84 | static const snd_device_t taiko_apq8084_CDP_variant_devices[] = { |
| 85 | SND_DEVICE_IN_HANDSET_MIC, |
| 86 | }; |
| 87 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 88 | static const snd_device_t taiko_liquid_variant_devices[] = { |
| 89 | SND_DEVICE_OUT_SPEAKER, |
| 90 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 91 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 92 | SND_DEVICE_IN_SPEAKER_MIC, |
| 93 | SND_DEVICE_IN_HEADSET_MIC, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 94 | SND_DEVICE_IN_VOICE_DMIC, |
| 95 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC, |
| 96 | SND_DEVICE_IN_VOICE_REC_DMIC_STEREO, |
| 97 | SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE, |
| 98 | SND_DEVICE_IN_QUAD_MIC, |
Aalique Grahame | 22e4910 | 2018-12-18 14:23:57 -0800 | [diff] [blame] | 99 | SND_DEVICE_IN_HANDSET_DMIC_STEREO, |
| 100 | SND_DEVICE_IN_SPEAKER_DMIC_STEREO, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 101 | }; |
| 102 | |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 103 | static const snd_device_t tomtom_msm8994_CDP_variant_devices[] = { |
| 104 | SND_DEVICE_IN_HANDSET_MIC, |
| 105 | }; |
| 106 | |
| 107 | static const snd_device_t tomtom_liquid_variant_devices[] = { |
| 108 | SND_DEVICE_OUT_SPEAKER, |
Tanya Finkel | b762e50 | 2014-07-10 08:03:01 -0700 | [diff] [blame] | 109 | SND_DEVICE_OUT_SPEAKER_EXTERNAL_1, |
| 110 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1, |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 111 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 112 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 113 | SND_DEVICE_IN_SPEAKER_MIC, |
| 114 | SND_DEVICE_IN_HEADSET_MIC, |
| 115 | SND_DEVICE_IN_VOICE_DMIC, |
| 116 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC, |
| 117 | SND_DEVICE_IN_VOICE_REC_DMIC_STEREO, |
| 118 | SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE, |
| 119 | SND_DEVICE_IN_QUAD_MIC, |
Aalique Grahame | 22e4910 | 2018-12-18 14:23:57 -0800 | [diff] [blame] | 120 | SND_DEVICE_IN_HANDSET_DMIC_STEREO, |
| 121 | SND_DEVICE_IN_SPEAKER_DMIC_STEREO, |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | static const snd_device_t tomtom_stp_variant_devices[] = { |
| 125 | SND_DEVICE_OUT_SPEAKER, |
| 126 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 127 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 128 | }; |
| 129 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 130 | static const snd_device_t taiko_DB_variant_devices[] = { |
| 131 | SND_DEVICE_OUT_SPEAKER, |
| 132 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 133 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 134 | SND_DEVICE_IN_SPEAKER_MIC, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 135 | SND_DEVICE_IN_HEADSET_MIC, |
| 136 | SND_DEVICE_IN_QUAD_MIC, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 137 | }; |
| 138 | |
Tanya Finkel | ca73596 | 2014-11-05 23:17:25 +0200 | [diff] [blame] | 139 | static const snd_device_t tomtom_DB_variant_devices[] = { |
| 140 | SND_DEVICE_OUT_SPEAKER, |
| 141 | SND_DEVICE_OUT_SPEAKER_EXTERNAL_1, |
| 142 | SND_DEVICE_OUT_SPEAKER_EXTERNAL_2, |
| 143 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1, |
| 144 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2, |
| 145 | SND_DEVICE_OUT_VOICE_SPEAKER, |
| 146 | SND_DEVICE_IN_VOICE_SPEAKER_MIC, |
| 147 | SND_DEVICE_IN_HANDSET_MIC, |
| 148 | SND_DEVICE_IN_HANDSET_MIC_EXTERNAL |
| 149 | }; |
| 150 | |
Tanya Finkel | 2f96e84 | 2015-06-29 13:27:57 +0300 | [diff] [blame] | 151 | static const snd_device_t tasha_DB_variant_devices[] = { |
| 152 | SND_DEVICE_OUT_SPEAKER |
| 153 | }; |
| 154 | |
Anna Hanna Sedlak Grinbaum | b19ec45 | 2016-08-01 17:32:23 +0300 | [diff] [blame] | 155 | static const snd_device_t tasha_sbc_variant_devices[] = { |
| 156 | SND_DEVICE_IN_HANDSET_MIC |
| 157 | }; |
| 158 | |
Tanya Finkel | 4594f75 | 2014-02-13 15:10:17 +0200 | [diff] [blame] | 159 | static const snd_device_t taiko_apq8084_sbc_variant_devices[] = { |
| 160 | SND_DEVICE_IN_HANDSET_MIC, |
| 161 | SND_DEVICE_IN_SPEAKER_MIC, |
| 162 | }; |
| 163 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 164 | static const snd_device_t tapan_lite_variant_devices[] = { |
| 165 | SND_DEVICE_OUT_SPEAKER, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 166 | SND_DEVICE_OUT_HEADPHONES, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 167 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 168 | SND_DEVICE_OUT_VOICE_HEADPHONES, |
| 169 | SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES, |
| 170 | SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 171 | }; |
| 172 | |
| 173 | static const snd_device_t tapan_skuf_variant_devices[] = { |
| 174 | SND_DEVICE_OUT_SPEAKER, |
| 175 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 176 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 177 | /*SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET,*/ |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | static const snd_device_t tapan_lite_skuf_variant_devices[] = { |
| 181 | SND_DEVICE_OUT_SPEAKER, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 182 | SND_DEVICE_OUT_HEADPHONES, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 183 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 184 | SND_DEVICE_OUT_VOICE_HEADPHONES, |
| 185 | SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES, |
| 186 | SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 187 | }; |
| 188 | |
| 189 | static const snd_device_t helicon_skuab_variant_devices[] = { |
| 190 | SND_DEVICE_OUT_SPEAKER, |
| 191 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 192 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
Walter Yang | 1d50ce6 | 2014-02-21 11:12:58 +0800 | [diff] [blame] | 193 | SND_DEVICE_OUT_VOICE_SPEAKER, |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 194 | }; |
| 195 | |
Vidyakumar Athota | e05c480 | 2015-07-16 11:20:44 -0700 | [diff] [blame] | 196 | static const snd_device_t tasha_fluid_variant_devices[] = { |
| 197 | SND_DEVICE_OUT_SPEAKER, |
| 198 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 199 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 200 | SND_DEVICE_OUT_VOICE_SPEAKER, |
| 201 | SND_DEVICE_OUT_SPEAKER_AND_HDMI, |
| 202 | SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET, |
| 203 | SND_DEVICE_OUT_SPEAKER_PROTECTED, |
| 204 | SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED, |
| 205 | }; |
| 206 | |
| 207 | static const snd_device_t tasha_liquid_variant_devices[] = { |
| 208 | SND_DEVICE_OUT_SPEAKER, |
| 209 | SND_DEVICE_OUT_SPEAKER_EXTERNAL_1, |
| 210 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1, |
| 211 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 212 | SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET, |
| 213 | SND_DEVICE_IN_SPEAKER_MIC, |
| 214 | SND_DEVICE_IN_HEADSET_MIC, |
| 215 | SND_DEVICE_IN_VOICE_DMIC, |
| 216 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC, |
| 217 | SND_DEVICE_IN_VOICE_REC_DMIC_STEREO, |
| 218 | SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE, |
| 219 | SND_DEVICE_IN_QUAD_MIC, |
Aalique Grahame | 22e4910 | 2018-12-18 14:23:57 -0800 | [diff] [blame] | 220 | SND_DEVICE_IN_HANDSET_DMIC_STEREO, |
| 221 | SND_DEVICE_IN_SPEAKER_DMIC_STEREO, |
Vidyakumar Athota | e05c480 | 2015-07-16 11:20:44 -0700 | [diff] [blame] | 222 | }; |
| 223 | |
Honghao Liu | 1ed0b4d | 2018-01-15 10:59:32 -0500 | [diff] [blame] | 224 | |
Xiaoyu Ye | 1138048 | 2017-07-19 16:47:59 -0700 | [diff] [blame] | 225 | static const snd_device_t tavil_qrd_variant_devices[] = { |
Karthikeyan Mani | 1e8a4b7 | 2017-08-24 11:05:50 -0700 | [diff] [blame] | 226 | SND_DEVICE_OUT_SPEAKER, |
| 227 | SND_DEVICE_OUT_VOICE_SPEAKER, |
| 228 | SND_DEVICE_OUT_HANDSET, |
| 229 | SND_DEVICE_OUT_VOICE_HANDSET, |
| 230 | SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET, |
Xiaoyu Ye | 1138048 | 2017-07-19 16:47:59 -0700 | [diff] [blame] | 231 | }; |
| 232 | |
Meng Wang | 91affea | 2018-06-04 15:16:26 +0800 | [diff] [blame] | 233 | static const snd_device_t tavil_qrd_msmnile_variant_devices[] = { |
| 234 | SND_DEVICE_OUT_SPEAKER, |
| 235 | SND_DEVICE_OUT_VOICE_SPEAKER, |
| 236 | SND_DEVICE_OUT_HANDSET, |
| 237 | SND_DEVICE_OUT_VOICE_HANDSET, |
| 238 | SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET, |
Yunfei Zhang | f1bba38 | 2018-09-28 19:15:16 +0800 | [diff] [blame] | 239 | SND_DEVICE_IN_VOICE_HEADSET_MIC, |
kunleiz | 4b4db4b | 2018-07-09 13:04:07 +0800 | [diff] [blame] | 240 | SND_DEVICE_IN_HANDSET_MIC, |
| 241 | SND_DEVICE_IN_HANDSET_MIC_AEC, |
| 242 | SND_DEVICE_IN_HANDSET_MIC_NS, |
| 243 | SND_DEVICE_IN_HANDSET_MIC_AEC_NS, |
Meng Wang | 91affea | 2018-06-04 15:16:26 +0800 | [diff] [blame] | 244 | SND_DEVICE_IN_SPEAKER_MIC, |
kunleiz | 9644b27 | 2018-06-12 18:14:26 +0800 | [diff] [blame] | 245 | SND_DEVICE_IN_VOICE_SPEAKER_MIC, |
kunleiz | 4b4db4b | 2018-07-09 13:04:07 +0800 | [diff] [blame] | 246 | SND_DEVICE_IN_SPEAKER_MIC_AEC, |
| 247 | SND_DEVICE_IN_SPEAKER_MIC_NS, |
| 248 | SND_DEVICE_IN_SPEAKER_MIC_AEC_NS, |
kunleiz | 9644b27 | 2018-06-12 18:14:26 +0800 | [diff] [blame] | 249 | SND_DEVICE_IN_VOICE_DMIC, |
| 250 | SND_DEVICE_IN_HANDSET_DMIC, |
kunleiz | 27c1449 | 2018-11-05 15:04:49 +0800 | [diff] [blame] | 251 | SND_DEVICE_IN_HANDSET_DMIC_NS, |
| 252 | SND_DEVICE_IN_HANDSET_DMIC_AEC, |
| 253 | SND_DEVICE_IN_HANDSET_DMIC_AEC_NS, |
Aalique Grahame | 22e4910 | 2018-12-18 14:23:57 -0800 | [diff] [blame] | 254 | SND_DEVICE_IN_HANDSET_DMIC_STEREO, |
| 255 | SND_DEVICE_IN_SPEAKER_DMIC_STEREO, |
kunleiz | 9644b27 | 2018-06-12 18:14:26 +0800 | [diff] [blame] | 256 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC, |
kunleiz | 27c1449 | 2018-11-05 15:04:49 +0800 | [diff] [blame] | 257 | SND_DEVICE_IN_SPEAKER_DMIC_AEC, |
| 258 | SND_DEVICE_IN_SPEAKER_DMIC_NS, |
| 259 | SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS, |
kunleiz | 4b4db4b | 2018-07-09 13:04:07 +0800 | [diff] [blame] | 260 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE, |
| 261 | SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE, |
| 262 | SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE, |
| 263 | SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE, |
kunleiz | 9644b27 | 2018-06-12 18:14:26 +0800 | [diff] [blame] | 264 | SND_DEVICE_IN_THREE_MIC, |
| 265 | SND_DEVICE_IN_HANDSET_TMIC, |
| 266 | SND_DEVICE_IN_HANDSET_TMIC_FLUENCE_PRO, |
| 267 | SND_DEVICE_IN_HANDSET_TMIC_AEC, |
| 268 | SND_DEVICE_IN_HANDSET_TMIC_NS, |
| 269 | SND_DEVICE_IN_HANDSET_TMIC_AEC_NS, |
| 270 | SND_DEVICE_IN_VOICE_SPEAKER_TMIC, |
| 271 | SND_DEVICE_IN_SPEAKER_TMIC_AEC, |
| 272 | SND_DEVICE_IN_SPEAKER_TMIC_NS, |
| 273 | SND_DEVICE_IN_SPEAKER_TMIC_AEC_NS, |
| 274 | SND_DEVICE_IN_QUAD_MIC, |
| 275 | SND_DEVICE_IN_HANDSET_QMIC, |
| 276 | SND_DEVICE_IN_SPEAKER_QMIC_AEC, |
| 277 | SND_DEVICE_IN_SPEAKER_QMIC_NS, |
| 278 | SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS, |
| 279 | SND_DEVICE_IN_VOICE_SPEAKER_QMIC, |
| 280 | SND_DEVICE_IN_AANC_HANDSET_MIC, |
| 281 | SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET, |
| 282 | SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC, |
Xiaojun Sang | fa1db6f | 2018-07-10 16:35:23 +0800 | [diff] [blame] | 283 | SND_DEVICE_OUT_SPEAKER_PROTECTED, |
| 284 | SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED, |
| 285 | SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED, |
Meng Wang | 91affea | 2018-06-04 15:16:26 +0800 | [diff] [blame] | 286 | }; |
| 287 | |
| 288 | |
Honghao Liu | 1ed0b4d | 2018-01-15 10:59:32 -0500 | [diff] [blame] | 289 | static const snd_device_t auto_variant_devices[] = { |
| 290 | SND_DEVICE_OUT_SPEAKER |
| 291 | }; |
| 292 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 293 | static void update_hardware_info_8084(struct hardware_info *hw_info, const char *snd_card_name) |
| 294 | { |
Helen Zeng | 6a16ad7 | 2014-02-23 22:04:44 -0800 | [diff] [blame] | 295 | if (!strcmp(snd_card_name, "apq8084-taiko-mtp-snd-card") || |
| 296 | !strncmp(snd_card_name, "apq8084-taiko-i2s-mtp-snd-card", |
Vidyakumar Athota | b4dbbbe | 2014-03-06 14:34:40 -0800 | [diff] [blame] | 297 | sizeof("apq8084-taiko-i2s-mtp-snd-card")) || |
| 298 | !strncmp(snd_card_name, "apq8084-tomtom-mtp-snd-card", |
| 299 | sizeof("apq8084-tomtom-mtp-snd-card"))) { |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 300 | strlcpy(hw_info->type, "mtp", sizeof(hw_info->type)); |
| 301 | strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name)); |
| 302 | hw_info->snd_devices = NULL; |
| 303 | hw_info->num_snd_devices = 0; |
| 304 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
Vidyakumar Athota | b4dbbbe | 2014-03-06 14:34:40 -0800 | [diff] [blame] | 305 | } else if ((!strcmp(snd_card_name, "apq8084-taiko-cdp-snd-card")) || |
| 306 | !strncmp(snd_card_name, "apq8084-tomtom-cdp-snd-card", |
| 307 | sizeof("apq8084-tomtom-cdp-snd-card"))) { |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 308 | strlcpy(hw_info->type, " cdp", sizeof(hw_info->type)); |
| 309 | strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name)); |
Banajit Goswami | d60ca7f | 2013-11-16 20:55:49 -0800 | [diff] [blame] | 310 | hw_info->snd_devices = (snd_device_t *)taiko_apq8084_CDP_variant_devices; |
| 311 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_CDP_variant_devices); |
| 312 | strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn)); |
Helen Zeng | 6a16ad7 | 2014-02-23 22:04:44 -0800 | [diff] [blame] | 313 | } else if (!strncmp(snd_card_name, "apq8084-taiko-i2s-cdp-snd-card", |
| 314 | sizeof("apq8084-taiko-i2s-cdp-snd-card"))) { |
| 315 | strlcpy(hw_info->type, " cdp", sizeof(hw_info->type)); |
| 316 | strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name)); |
| 317 | hw_info->snd_devices = NULL; |
| 318 | hw_info->num_snd_devices = 0; |
| 319 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 320 | } else if (!strcmp(snd_card_name, "apq8084-taiko-liquid-snd-card")) { |
| 321 | strlcpy(hw_info->type , " liquid", sizeof(hw_info->type)); |
| 322 | strlcpy(hw_info->name, "apq8084", sizeof(hw_info->type)); |
| 323 | hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices; |
| 324 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices); |
Banajit Goswami | d60ca7f | 2013-11-16 20:55:49 -0800 | [diff] [blame] | 325 | strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn)); |
Tanya Finkel | 4594f75 | 2014-02-13 15:10:17 +0200 | [diff] [blame] | 326 | } else if (!strcmp(snd_card_name, "apq8084-taiko-sbc-snd-card")) { |
| 327 | strlcpy(hw_info->type, " sbc", sizeof(hw_info->type)); |
| 328 | strlcpy(hw_info->name, "apq8084", sizeof(hw_info->name)); |
| 329 | hw_info->snd_devices = (snd_device_t *)taiko_apq8084_sbc_variant_devices; |
| 330 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_apq8084_sbc_variant_devices); |
| 331 | strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn)); |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 332 | } else { |
| 333 | ALOGW("%s: Not an 8084 device", __func__); |
| 334 | } |
| 335 | } |
| 336 | |
Josh Kirsch | c389437 | 2016-03-28 15:59:48 -0700 | [diff] [blame] | 337 | static void update_hardware_info_8096(struct hardware_info *hw_info, const char *snd_card_name) |
| 338 | { |
| 339 | if (!strcmp(snd_card_name, "apq8096-tasha-i2c-snd-card")) { |
| 340 | ALOGW("%s: Updating hardware info for APQ 8096", __func__); |
| 341 | strlcpy(hw_info->type, "mtp", sizeof(hw_info->type)); |
| 342 | strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name)); |
| 343 | hw_info->snd_devices = NULL; |
| 344 | hw_info->num_snd_devices = 0; |
| 345 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
Honghao Liu | 1ed0b4d | 2018-01-15 10:59:32 -0500 | [diff] [blame] | 346 | } else if (!strcmp(snd_card_name, "apq8096-auto-snd-card")) { |
| 347 | strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type)); |
| 348 | strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name)); |
| 349 | hw_info->snd_devices = (snd_device_t *)auto_variant_devices; |
| 350 | hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices); |
| 351 | strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn)); |
| 352 | } else if (!strcmp(snd_card_name, "apq8096-adp-agave-snd-card")) { |
| 353 | strlcpy(hw_info->type, " agave", sizeof(hw_info->type)); |
| 354 | strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name)); |
| 355 | hw_info->snd_devices = (snd_device_t *)auto_variant_devices; |
| 356 | hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices); |
| 357 | strlcpy(hw_info->dev_extn, "-agave", sizeof(hw_info->dev_extn)); |
| 358 | } else if (!strcmp(snd_card_name, "apq8096-adp-mmxf-snd-card")) { |
| 359 | strlcpy(hw_info->type, " mmxf", sizeof(hw_info->type)); |
| 360 | strlcpy(hw_info->name, "apq8096", sizeof(hw_info->name)); |
| 361 | hw_info->snd_devices = (snd_device_t *)auto_variant_devices; |
| 362 | hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices); |
| 363 | strlcpy(hw_info->dev_extn, "-mmxf", sizeof(hw_info->dev_extn)); |
Josh Kirsch | c389437 | 2016-03-28 15:59:48 -0700 | [diff] [blame] | 364 | } else { |
| 365 | ALOGW("%s: Not an 8096 device", __func__); |
| 366 | } |
| 367 | } |
| 368 | |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 369 | static void update_hardware_info_8994(struct hardware_info *hw_info, const char *snd_card_name) |
| 370 | { |
| 371 | if (!strcmp(snd_card_name, "msm8994-tomtom-mtp-snd-card")) { |
| 372 | strlcpy(hw_info->type, " mtp", sizeof(hw_info->type)); |
| 373 | strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name)); |
| 374 | hw_info->snd_devices = NULL; |
| 375 | hw_info->num_snd_devices = 0; |
| 376 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
Mingming Yin | e5575ab | 2014-05-23 11:00:34 -0700 | [diff] [blame] | 377 | } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) { |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 378 | strlcpy(hw_info->type, " cdp", sizeof(hw_info->type)); |
| 379 | strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name)); |
| 380 | hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices; |
| 381 | hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices); |
| 382 | strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn)); |
Mingming Yin | e5575ab | 2014-05-23 11:00:34 -0700 | [diff] [blame] | 383 | } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) { |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 384 | strlcpy(hw_info->type, " stp", sizeof(hw_info->type)); |
| 385 | strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name)); |
| 386 | hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices; |
| 387 | hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices); |
| 388 | strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn)); |
Mingming Yin | e5575ab | 2014-05-23 11:00:34 -0700 | [diff] [blame] | 389 | } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) { |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 390 | strlcpy(hw_info->type, " liquid", sizeof(hw_info->type)); |
| 391 | strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name)); |
| 392 | hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices; |
| 393 | hw_info->num_snd_devices = ARRAY_SIZE(tomtom_liquid_variant_devices); |
| 394 | strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn)); |
Tanya Finkel | ca73596 | 2014-11-05 23:17:25 +0200 | [diff] [blame] | 395 | } else if (!strcmp(snd_card_name, "msm8994-tomtom-db-snd-card")) { |
| 396 | strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type)); |
| 397 | strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name)); |
| 398 | hw_info->snd_devices = (snd_device_t *)tomtom_DB_variant_devices; |
| 399 | hw_info->num_snd_devices = ARRAY_SIZE(tomtom_DB_variant_devices); |
| 400 | strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn)); |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 401 | } else { |
| 402 | ALOGW("%s: Not an 8994 device", __func__); |
| 403 | } |
| 404 | } |
| 405 | |
Mingming Yin | 89c6a7f | 2015-03-24 11:56:14 -0700 | [diff] [blame] | 406 | static void update_hardware_info_8996(struct hardware_info *hw_info, const char *snd_card_name) |
Banajit Goswami | 22582e7 | 2014-10-15 18:29:34 -0700 | [diff] [blame] | 407 | { |
Neema Shetty | 52a72c7 | 2015-08-26 12:26:06 -0700 | [diff] [blame] | 408 | if (!strcmp(snd_card_name, "msm8996-tasha-fluid-snd-card")) { |
Vidyakumar Athota | e05c480 | 2015-07-16 11:20:44 -0700 | [diff] [blame] | 409 | strlcpy(hw_info->type, " fluid", sizeof(hw_info->type)); |
| 410 | strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name)); |
| 411 | hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices; |
| 412 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices); |
| 413 | strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn)); |
| 414 | } else if (!strcmp(snd_card_name, "msm8996-tasha-liquid-snd-card")) { |
| 415 | strlcpy(hw_info->type, " liquid", sizeof(hw_info->type)); |
| 416 | strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name)); |
| 417 | hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices; |
| 418 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices); |
| 419 | strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn)); |
Tanya Finkel | 2f96e84 | 2015-06-29 13:27:57 +0300 | [diff] [blame] | 420 | } else if (!strcmp(snd_card_name, "msm8996-tasha-db-snd-card")) { |
| 421 | strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type)); |
| 422 | strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name)); |
| 423 | hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices; |
| 424 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices); |
| 425 | strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn)); |
Anna Hanna Sedlak Grinbaum | b19ec45 | 2016-08-01 17:32:23 +0300 | [diff] [blame] | 426 | } else if (!strcmp(snd_card_name, "msm8996-tasha-sbc-snd-card")) { |
| 427 | strlcpy(hw_info->type, " sbc", sizeof(hw_info->type)); |
| 428 | strlcpy(hw_info->name, "msm8996", sizeof(hw_info->name)); |
| 429 | hw_info->snd_devices = (snd_device_t *)tasha_sbc_variant_devices; |
| 430 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_sbc_variant_devices); |
| 431 | strlcpy(hw_info->dev_extn, "-sbc", sizeof(hw_info->dev_extn)); |
Banajit Goswami | 22582e7 | 2014-10-15 18:29:34 -0700 | [diff] [blame] | 432 | } else { |
Mingming Yin | 89c6a7f | 2015-03-24 11:56:14 -0700 | [diff] [blame] | 433 | ALOGW("%s: Not a 8996 device", __func__); |
Banajit Goswami | 22582e7 | 2014-10-15 18:29:34 -0700 | [diff] [blame] | 434 | } |
| 435 | } |
| 436 | |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 437 | static void update_hardware_info_msm8998(struct hardware_info *hw_info, const char *snd_card_name) |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 438 | { |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 439 | if (!strcmp(snd_card_name, "msm8998-tasha-fluid-snd-card")) { |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 440 | strlcpy(hw_info->type, " fluid", sizeof(hw_info->type)); |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 441 | strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name)); |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 442 | hw_info->snd_devices = (snd_device_t *)tasha_fluid_variant_devices; |
| 443 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_fluid_variant_devices); |
Rohit kumar | d3c3b91 | 2016-11-15 18:50:31 +0530 | [diff] [blame] | 444 | hw_info->is_stereo_spkr = false; |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 445 | strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn)); |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 446 | } else if (!strcmp(snd_card_name, "msm8998-tasha-liquid-snd-card")) { |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 447 | strlcpy(hw_info->type, " liquid", sizeof(hw_info->type)); |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 448 | strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name)); |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 449 | hw_info->snd_devices = (snd_device_t *)tasha_liquid_variant_devices; |
| 450 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_liquid_variant_devices); |
| 451 | strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn)); |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 452 | } else if (!strcmp(snd_card_name, "msm8998-tasha-db-snd-card")) { |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 453 | strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type)); |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 454 | strlcpy(hw_info->name, "msm8998", sizeof(hw_info->name)); |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 455 | hw_info->snd_devices = (snd_device_t *)tasha_DB_variant_devices; |
| 456 | hw_info->num_snd_devices = ARRAY_SIZE(tasha_DB_variant_devices); |
| 457 | strlcpy(hw_info->dev_extn, "-db", sizeof(hw_info->dev_extn)); |
kunleiz | aa6a3f1 | 2017-01-19 12:28:28 +0800 | [diff] [blame] | 458 | } else if (!strcmp(snd_card_name, "msm8998-qvr-tavil-snd-card")) { |
| 459 | hw_info->is_stereo_spkr = false; |
| 460 | } else if (!strcmp(snd_card_name, "msm8998-skuk-tavil-snd-card")) { |
| 461 | hw_info->is_stereo_spkr = false; |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 462 | } else { |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 463 | ALOGW("%s: Not a msm8998 device", __func__); |
Banajit Goswami | 4c0dff2 | 2016-03-04 18:31:22 -0800 | [diff] [blame] | 464 | } |
| 465 | } |
| 466 | |
Xiaoyu Ye | 1138048 | 2017-07-19 16:47:59 -0700 | [diff] [blame] | 467 | static void update_hardware_info_sdm845(struct hardware_info *hw_info, const char *snd_card_name) |
Xiaoyu Ye | 0afc923 | 2017-03-28 21:31:22 -0700 | [diff] [blame] | 468 | { |
Xiaoyu Ye | 1138048 | 2017-07-19 16:47:59 -0700 | [diff] [blame] | 469 | if (!strcmp(snd_card_name, "sdm845-tavil-qrd-snd-card")) { |
| 470 | strlcpy(hw_info->type, " qrd", sizeof(hw_info->type)); |
| 471 | strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name)); |
| 472 | hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices; |
| 473 | hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices); |
| 474 | hw_info->is_stereo_spkr = false; |
| 475 | strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn)); |
Meng Wang | 69b865c | 2017-10-30 15:12:12 +0800 | [diff] [blame] | 476 | } else if (!strcmp(snd_card_name, "sdm845-tavil-hdk-snd-card")) { |
| 477 | strlcpy(hw_info->type, " hdk", sizeof(hw_info->type)); |
| 478 | strlcpy(hw_info->name, "sdm845", sizeof(hw_info->name)); |
| 479 | hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices; |
| 480 | hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices); |
| 481 | hw_info->is_stereo_spkr = false; |
| 482 | strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn)); |
Meng Wang | 43a5e10 | 2017-11-01 10:49:01 +0800 | [diff] [blame] | 483 | } else if (!strcmp(snd_card_name, "sdm845-qvr-tavil-snd-card")) { |
| 484 | hw_info->is_stereo_spkr = false; |
Xiaoyu Ye | 1138048 | 2017-07-19 16:47:59 -0700 | [diff] [blame] | 485 | } else { |
Xiaoyu Ye | 0afc923 | 2017-03-28 21:31:22 -0700 | [diff] [blame] | 486 | ALOGW("%s: Not a sdm845 device", __func__); |
Xiaoyu Ye | 1138048 | 2017-07-19 16:47:59 -0700 | [diff] [blame] | 487 | } |
Xiaoyu Ye | 0afc923 | 2017-03-28 21:31:22 -0700 | [diff] [blame] | 488 | } |
| 489 | |
Meng Wang | 8e5dccc | 2018-03-05 15:52:24 +0800 | [diff] [blame] | 490 | static void update_hardware_info_msmnile(struct hardware_info *hw_info, const char *snd_card_name) |
Xiaoyu Ye | 91553e6 | 2017-11-21 17:35:50 -0800 | [diff] [blame] | 491 | { |
Meng Wang | 8e5dccc | 2018-03-05 15:52:24 +0800 | [diff] [blame] | 492 | if (strstr(snd_card_name, "qrd")) { |
| 493 | strlcpy(hw_info->type, " qrd", sizeof(hw_info->type)); |
| 494 | strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name)); |
Meng Wang | 91affea | 2018-06-04 15:16:26 +0800 | [diff] [blame] | 495 | hw_info->snd_devices = (snd_device_t *)tavil_qrd_msmnile_variant_devices; |
| 496 | hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_msmnile_variant_devices); |
Meng Wang | 8e5dccc | 2018-03-05 15:52:24 +0800 | [diff] [blame] | 497 | hw_info->is_stereo_spkr = false; |
| 498 | strlcpy(hw_info->dev_extn, "-qrd", sizeof(hw_info->dev_extn)); |
Vidyakumar Athota | 460cc66 | 2018-04-01 21:05:57 -0700 | [diff] [blame] | 499 | } else if (strstr(snd_card_name, "pahu")) { |
| 500 | strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name)); |
| 501 | hw_info->is_stereo_spkr = false; |
Derek Chen | 4d6f770 | 2018-07-07 14:04:27 -0700 | [diff] [blame] | 502 | } else if (strstr(snd_card_name, "adp")) { |
| 503 | strlcpy(hw_info->type, "adp", sizeof(hw_info->type)); |
| 504 | strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name)); |
| 505 | hw_info->snd_devices = (snd_device_t *)auto_variant_devices; |
| 506 | hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices); |
| 507 | strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn)); |
| 508 | } else if (strstr(snd_card_name, "custom")) { |
| 509 | strlcpy(hw_info->type, "custom", sizeof(hw_info->type)); |
| 510 | strlcpy(hw_info->name, "msmnile", sizeof(hw_info->name)); |
| 511 | hw_info->snd_devices = (snd_device_t *)auto_variant_devices; |
| 512 | hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices); |
| 513 | strlcpy(hw_info->dev_extn, "-custom", sizeof(hw_info->dev_extn)); |
Meng Wang | 8e5dccc | 2018-03-05 15:52:24 +0800 | [diff] [blame] | 514 | } else { |
| 515 | ALOGW("%s: Not a msmnile device", __func__); |
| 516 | } |
Xiaoyu Ye | 91553e6 | 2017-11-21 17:35:50 -0800 | [diff] [blame] | 517 | } |
| 518 | |
Meng Wang | ef2f6e1 | 2018-10-08 13:06:05 +0800 | [diff] [blame] | 519 | static void update_hardware_info_kona( |
| 520 | struct hardware_info *hw_info, |
| 521 | const char *snd_card_name) |
| 522 | { |
Harshal Ahire | 4637415 | 2019-10-22 11:37:12 +0530 | [diff] [blame] | 523 | if (!strncmp(snd_card_name, "bengal-idp-snd-card", |
| 524 | sizeof("bengal-idp-snd-card"))) { |
| 525 | strlcpy(hw_info->name, "bengal", sizeof(hw_info->name)); |
| 526 | hw_info->is_stereo_spkr = false; |
| 527 | } else if (!strncmp(snd_card_name, "kona-mtp-snd-card", |
Meng Wang | ef2f6e1 | 2018-10-08 13:06:05 +0800 | [diff] [blame] | 528 | sizeof("kona-mtp-snd-card"))) { |
| 529 | strlcpy(hw_info->name, "kona", sizeof(hw_info->name)); |
Vatsal Bucha | 6339b09 | 2019-04-17 16:27:32 +0530 | [diff] [blame] | 530 | } else if (!strncmp(snd_card_name, "lito-mtp-snd-card", |
| 531 | sizeof("lito-mtp-snd-card"))) { |
| 532 | strlcpy(hw_info->name, "lito", sizeof(hw_info->name)); |
Faiz Nabi Kuchay | 0b79d7d | 2019-08-05 20:36:31 +0530 | [diff] [blame] | 533 | } else if (!strncmp(snd_card_name, "atoll-idp-snd-card", |
| 534 | sizeof("atoll-idp-snd-card"))) { |
| 535 | strlcpy(hw_info->name, "atoll", sizeof(hw_info->name)); |
| 536 | } else if (!strncmp(snd_card_name, "atoll-wcd937x-snd-card", |
| 537 | sizeof("atoll-wcd937x-snd-card"))) { |
| 538 | strlcpy(hw_info->name, "atoll", sizeof(hw_info->name)); |
Kunlei Zhang | 47509fc | 2019-08-16 16:41:28 +0800 | [diff] [blame] | 539 | } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card", |
| 540 | sizeof("atoll-qrd-snd-card"))) { |
| 541 | strlcpy(hw_info->name, "atoll", sizeof(hw_info->name)); |
| 542 | hw_info->is_stereo_spkr = false; |
Meng Wang | ef2f6e1 | 2018-10-08 13:06:05 +0800 | [diff] [blame] | 543 | } else if (!strncmp(snd_card_name, "kona-qrd-snd-card", |
| 544 | sizeof("kona-qrd-snd-card"))) { |
| 545 | strlcpy(hw_info->name, "kona", sizeof(hw_info->name)); |
| 546 | hw_info->is_stereo_spkr = false; |
Vatsal Bucha | 6339b09 | 2019-04-17 16:27:32 +0530 | [diff] [blame] | 547 | } else if (!strncmp(snd_card_name, "lito-qrd-snd-card", |
| 548 | sizeof("lito-qrd-snd-card"))) { |
| 549 | strlcpy(hw_info->name, "lito", sizeof(hw_info->name)); |
| 550 | hw_info->is_stereo_spkr = false; |
Meng Wang | ef2f6e1 | 2018-10-08 13:06:05 +0800 | [diff] [blame] | 551 | } else { |
| 552 | ALOGW("%s: Not a kona device", __func__); |
| 553 | } |
| 554 | } |
| 555 | |
Josh Kirsch | f20adbf | 2018-03-06 16:26:22 -0800 | [diff] [blame] | 556 | static void update_hardware_info_sda845(struct hardware_info *hw_info, const char *snd_card_name) |
| 557 | { |
| 558 | if (!strncmp(snd_card_name, "sda845-tavil-i2s-snd-card", sizeof("sda845-tavil-i2s-snd-card"))) { |
| 559 | strlcpy(hw_info->type, " mtp", sizeof(hw_info->type)); |
| 560 | strlcpy(hw_info->name, "sda845", sizeof(hw_info->name)); |
| 561 | hw_info->snd_devices = NULL; |
| 562 | hw_info->num_snd_devices = 0; |
| 563 | hw_info->is_stereo_spkr = false; |
| 564 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
| 565 | } else { |
| 566 | ALOGW("%s: Not a sda845 device", __func__); |
| 567 | } |
| 568 | } |
| 569 | |
Xiaoyu Ye | c494c75 | 2017-11-02 18:52:48 -0700 | [diff] [blame] | 570 | static void update_hardware_info_sdx(struct hardware_info *hw_info __unused, const char *snd_card_name __unused) |
| 571 | { |
| 572 | ALOGW("%s: Not a sdx device", __func__); |
| 573 | } |
| 574 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 575 | static void update_hardware_info_8974(struct hardware_info *hw_info, const char *snd_card_name) |
| 576 | { |
| 577 | if (!strcmp(snd_card_name, "msm8974-taiko-mtp-snd-card")) { |
| 578 | strlcpy(hw_info->type, " mtp", sizeof(hw_info->type)); |
| 579 | strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name)); |
| 580 | hw_info->snd_devices = NULL; |
| 581 | hw_info->num_snd_devices = 0; |
| 582 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
| 583 | } else if (!strcmp(snd_card_name, "msm8974-taiko-cdp-snd-card")) { |
| 584 | strlcpy(hw_info->type, " cdp", sizeof(hw_info->type)); |
| 585 | strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name)); |
| 586 | hw_info->snd_devices = (snd_device_t *)taiko_CDP_variant_devices; |
| 587 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_CDP_variant_devices); |
Krishnankutty Kolathappilly | d801ae3 | 2013-11-03 15:48:42 -0800 | [diff] [blame] | 588 | strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn)); |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 589 | } else if (!strcmp(snd_card_name, "msm8974-taiko-fluid-snd-card")) { |
| 590 | strlcpy(hw_info->type, " fluid", sizeof(hw_info->type)); |
| 591 | strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name)); |
| 592 | hw_info->snd_devices = (snd_device_t *) taiko_fluid_variant_devices; |
| 593 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_fluid_variant_devices); |
| 594 | strlcpy(hw_info->dev_extn, "-fluid", sizeof(hw_info->dev_extn)); |
| 595 | } else if (!strcmp(snd_card_name, "msm8974-taiko-liquid-snd-card")) { |
| 596 | strlcpy(hw_info->type, " liquid", sizeof(hw_info->type)); |
| 597 | strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name)); |
| 598 | hw_info->snd_devices = (snd_device_t *)taiko_liquid_variant_devices; |
| 599 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_liquid_variant_devices); |
| 600 | strlcpy(hw_info->dev_extn, "-liquid", sizeof(hw_info->dev_extn)); |
| 601 | } else if (!strcmp(snd_card_name, "apq8074-taiko-db-snd-card")) { |
| 602 | strlcpy(hw_info->type, " dragon-board", sizeof(hw_info->type)); |
| 603 | strlcpy(hw_info->name, "msm8974", sizeof(hw_info->name)); |
| 604 | hw_info->snd_devices = (snd_device_t *)taiko_DB_variant_devices; |
| 605 | hw_info->num_snd_devices = ARRAY_SIZE(taiko_DB_variant_devices); |
| 606 | strlcpy(hw_info->dev_extn, "-DB", sizeof(hw_info->dev_extn)); |
| 607 | } else { |
| 608 | ALOGW("%s: Not an 8974 device", __func__); |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | static void update_hardware_info_8610(struct hardware_info *hw_info, const char *snd_card_name) |
| 613 | { |
| 614 | if (!strcmp(snd_card_name, "msm8x10-snd-card")) { |
| 615 | strlcpy(hw_info->type, "", sizeof(hw_info->type)); |
| 616 | strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name)); |
| 617 | hw_info->snd_devices = NULL; |
| 618 | hw_info->num_snd_devices = 0; |
| 619 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
| 620 | } else if (!strcmp(snd_card_name, "msm8x10-skuab-snd-card")) { |
| 621 | strlcpy(hw_info->type, "skuab", sizeof(hw_info->type)); |
| 622 | strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name)); |
| 623 | hw_info->snd_devices = (snd_device_t *)helicon_skuab_variant_devices; |
| 624 | hw_info->num_snd_devices = ARRAY_SIZE(helicon_skuab_variant_devices); |
| 625 | strlcpy(hw_info->dev_extn, "-skuab", sizeof(hw_info->dev_extn)); |
| 626 | } else if (!strcmp(snd_card_name, "msm8x10-skuaa-snd-card")) { |
| 627 | strlcpy(hw_info->type, " skuaa", sizeof(hw_info->type)); |
| 628 | strlcpy(hw_info->name, "msm8x10", sizeof(hw_info->name)); |
| 629 | hw_info->snd_devices = NULL; |
| 630 | hw_info->num_snd_devices = 0; |
| 631 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
| 632 | } else { |
| 633 | ALOGW("%s: Not an 8x10 device", __func__); |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | static void update_hardware_info_8226(struct hardware_info *hw_info, const char *snd_card_name) |
| 638 | { |
| 639 | if (!strcmp(snd_card_name, "msm8226-tapan-snd-card")) { |
| 640 | strlcpy(hw_info->type, "", sizeof(hw_info->type)); |
| 641 | strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name)); |
| 642 | hw_info->snd_devices = NULL; |
| 643 | hw_info->num_snd_devices = 0; |
| 644 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
| 645 | } else if (!strcmp(snd_card_name, "msm8226-tapan9302-snd-card")) { |
| 646 | strlcpy(hw_info->type, "tapan_lite", sizeof(hw_info->type)); |
| 647 | strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name)); |
| 648 | hw_info->snd_devices = (snd_device_t *)tapan_lite_variant_devices; |
| 649 | hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_variant_devices); |
| 650 | strlcpy(hw_info->dev_extn, "-lite", sizeof(hw_info->dev_extn)); |
| 651 | } else if (!strcmp(snd_card_name, "msm8226-tapan-skuf-snd-card")) { |
| 652 | strlcpy(hw_info->type, " skuf", sizeof(hw_info->type)); |
| 653 | strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name)); |
| 654 | hw_info->snd_devices = (snd_device_t *) tapan_skuf_variant_devices; |
| 655 | hw_info->num_snd_devices = ARRAY_SIZE(tapan_skuf_variant_devices); |
| 656 | strlcpy(hw_info->dev_extn, "-skuf", sizeof(hw_info->dev_extn)); |
| 657 | } else if (!strcmp(snd_card_name, "msm8226-tapan9302-skuf-snd-card")) { |
| 658 | strlcpy(hw_info->type, " tapan9302-skuf", sizeof(hw_info->type)); |
| 659 | strlcpy(hw_info->name, "msm8226", sizeof(hw_info->name)); |
| 660 | hw_info->snd_devices = (snd_device_t *)tapan_lite_skuf_variant_devices; |
| 661 | hw_info->num_snd_devices = ARRAY_SIZE(tapan_lite_skuf_variant_devices); |
| 662 | strlcpy(hw_info->dev_extn, "-skuf-lite", sizeof(hw_info->dev_extn)); |
| 663 | } else { |
| 664 | ALOGW("%s: Not an 8x26 device", __func__); |
| 665 | } |
| 666 | } |
| 667 | |
Preetam Singh Ranawat | d770a36 | 2017-05-24 19:07:15 +0530 | [diff] [blame] | 668 | static void update_hardware_info_bear(struct hardware_info *hw_info, const char *snd_card_name) |
| 669 | { |
Walter Yang | 319c6fe | 2017-09-21 17:09:39 +0800 | [diff] [blame] | 670 | if (!strncmp(snd_card_name, "sdm660-snd-card", |
Meng Wang | 923204f | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 671 | sizeof("sdm660-snd-card"))) { |
Preetam Singh Ranawat | d770a36 | 2017-05-24 19:07:15 +0530 | [diff] [blame] | 672 | strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name)); |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 673 | } else if (!strcmp(snd_card_name, "sdm660-snd-card-mtp")) { |
| 674 | strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name)); |
| 675 | } else if (!strcmp(snd_card_name, "sdm660-tasha-skus-snd-card")) { |
| 676 | hw_info->is_stereo_spkr = false; |
| 677 | strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name)); |
| 678 | } else if (!strcmp(snd_card_name, "sdm660-snd-card-skush")) { |
| 679 | strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name)); |
Meng Wang | c221926 | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 680 | } else if (!strncmp(snd_card_name, "qcs405-sku1-snd-card", |
| 681 | sizeof("qcs405-sku1-snd-card"))) { |
Dhananjay Kumar | 75c9a0c | 2018-06-07 15:59:00 +0530 | [diff] [blame] | 682 | strlcpy(hw_info->name, "qcs405", sizeof(hw_info->name)); |
Meng Wang | c221926 | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 683 | } else if (!strncmp(snd_card_name, "qcs605-lc-snd-card", |
| 684 | sizeof("qcs605-lc-snd-card"))) { |
Sachin Mohan Gadag | effd756 | 2018-02-13 17:10:09 +0530 | [diff] [blame] | 685 | strlcpy(hw_info->name, "qcs605-lc", sizeof(hw_info->name)); |
yang liu | 9f4232d | 2018-09-18 20:51:11 +0800 | [diff] [blame] | 686 | } else if (!strncmp(snd_card_name, "qcs605-ipc-tavil-snd-card", |
| 687 | sizeof("qcs605-ipc-tavil-snd-card"))) { |
| 688 | strlcpy(hw_info->name, "qcs605-ipc", sizeof(hw_info->name)); |
Meng Wang | 923204f | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 689 | } else if (!strncmp(snd_card_name, "sdm660-tavil-snd-card", |
| 690 | sizeof("sdm660-tavil-snd-card"))) { |
Preetam Singh Ranawat | d770a36 | 2017-05-24 19:07:15 +0530 | [diff] [blame] | 691 | strlcpy(hw_info->name, "sdm660", sizeof(hw_info->name)); |
Meng Wang | 923204f | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 692 | } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card", |
| 693 | sizeof("sdm670-skuw-snd-card"))) { |
Walter Yang | 319c6fe | 2017-09-21 17:09:39 +0800 | [diff] [blame] | 694 | hw_info->is_stereo_spkr = false; |
Meng Wang | 923204f | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 695 | } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card", |
| 696 | sizeof("sdm670-tavil-hdk-snd-card"))) { |
| 697 | strlcpy(hw_info->type, " hdk", sizeof(hw_info->type)); |
| 698 | strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name)); |
| 699 | hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices; |
| 700 | hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices); |
| 701 | hw_info->is_stereo_spkr = false; |
| 702 | strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn)); |
Naresh Tanniru | c21e202 | 2018-08-13 21:58:06 +0530 | [diff] [blame] | 703 | } else if (!strncmp(snd_card_name, "sm6150-idp-snd-card", |
| 704 | sizeof("sm6150-idp-snd-card"))) { |
| 705 | strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name)); |
Aditya Bavanari | 4dbceed | 2018-10-11 18:31:55 +0530 | [diff] [blame] | 706 | } else if (!strncmp(snd_card_name, "sm6150-wcd9375-snd-card", |
| 707 | sizeof("sm6150-wcd9375-snd-card"))) { |
| 708 | strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name)); |
Xiaojun Sang | fcddd67 | 2018-08-15 17:53:48 +0800 | [diff] [blame] | 709 | } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card", |
| 710 | sizeof("sm6150-qrd-snd-card"))) { |
| 711 | hw_info->is_stereo_spkr = false; |
| 712 | strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name)); |
kunleiz | 3ae92e5 | 2019-04-28 15:35:31 +0800 | [diff] [blame] | 713 | } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card", |
| 714 | sizeof("sm6150-wcd9375qrd-snd-card"))) { |
| 715 | strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name)); |
| 716 | hw_info->is_stereo_spkr = false; |
Naresh Tanniru | c21e202 | 2018-08-13 21:58:06 +0530 | [diff] [blame] | 717 | } else if (!strncmp(snd_card_name, "sm6150-tavil-snd-card", |
| 718 | sizeof("sm6150-tavil-snd-card"))) { |
| 719 | strlcpy(hw_info->name, "sm6150", sizeof(hw_info->name)); |
Naresh Tanniru | cb5b578 | 2018-10-12 20:42:07 +0530 | [diff] [blame] | 720 | hw_info->is_stereo_spkr = false; |
| 721 | } else if ( !strncmp(snd_card_name, "sdm670-tavil-hdk-snd-card", |
| 722 | sizeof("sdm670-tavil-hdk-snd-card"))) { |
| 723 | strlcpy(hw_info->type, " hdk", sizeof(hw_info->type)); |
| 724 | strlcpy(hw_info->name, "sdm670", sizeof(hw_info->name)); |
| 725 | hw_info->snd_devices = (snd_device_t *)tavil_qrd_variant_devices; |
| 726 | hw_info->num_snd_devices = ARRAY_SIZE(tavil_qrd_variant_devices); |
| 727 | hw_info->is_stereo_spkr = false; |
| 728 | strlcpy(hw_info->dev_extn, "-hdk", sizeof(hw_info->dev_extn)); |
Aditya Bavanari | 3c8e357 | 2018-12-18 16:44:16 +0530 | [diff] [blame] | 729 | } else if (!strncmp(snd_card_name, "trinket-idp-snd-card", |
| 730 | sizeof("trinket-idp-snd-card"))) { |
| 731 | hw_info->is_stereo_spkr = false; |
| 732 | strlcpy(hw_info->name, "trinket", sizeof(hw_info->name)); |
| 733 | } else if (!strncmp(snd_card_name, "trinket-tashalite-snd-card", |
| 734 | sizeof("trinket-tashalite-snd-card"))) { |
Aditya Bavanari | 3c8e357 | 2018-12-18 16:44:16 +0530 | [diff] [blame] | 735 | strlcpy(hw_info->name, "trinket", sizeof(hw_info->name)); |
| 736 | } else if (!strncmp(snd_card_name, "trinket-tasha-snd-card", |
| 737 | sizeof("trinket-tasha-snd-card"))) { |
Aditya Bavanari | 3c8e357 | 2018-12-18 16:44:16 +0530 | [diff] [blame] | 738 | strlcpy(hw_info->name, "trinket", sizeof(hw_info->name)); |
| 739 | } else if (!strncmp(snd_card_name, "trinket-tavil-snd-card", |
| 740 | sizeof("trinket-tavil-snd-card"))) { |
Aditya Bavanari | 3c8e357 | 2018-12-18 16:44:16 +0530 | [diff] [blame] | 741 | strlcpy(hw_info->name, "trinket", sizeof(hw_info->name)); |
Rahul Sharma | 093a4ad | 2018-12-26 16:53:51 +0530 | [diff] [blame] | 742 | } else if (!strncmp(snd_card_name, "sa6155-adp-star-snd-card", |
| 743 | sizeof("sa6155-adp-star-snd-card"))) { |
| 744 | strlcpy(hw_info->type, "adp", sizeof(hw_info->type)); |
| 745 | strlcpy(hw_info->name, "sa6155", sizeof(hw_info->name)); |
| 746 | hw_info->snd_devices = (snd_device_t *)auto_variant_devices; |
| 747 | hw_info->num_snd_devices = ARRAY_SIZE(auto_variant_devices); |
| 748 | strlcpy(hw_info->dev_extn, "-adp", sizeof(hw_info->dev_extn)); |
Meng Wang | 923204f | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 749 | } else { |
Preetam Singh Ranawat | d770a36 | 2017-05-24 19:07:15 +0530 | [diff] [blame] | 750 | ALOGW("%s: Not an SDM device", __func__); |
Meng Wang | 923204f | 2018-05-21 18:32:41 +0800 | [diff] [blame] | 751 | } |
Preetam Singh Ranawat | d770a36 | 2017-05-24 19:07:15 +0530 | [diff] [blame] | 752 | } |
| 753 | |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 754 | static void update_hardware_info_sdm439(struct hardware_info *hw_info, const char *snd_card_name) |
| 755 | { |
| 756 | if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) { |
| 757 | hw_info->is_stereo_spkr = false; |
| 758 | strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name)); |
| 759 | } else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) { |
| 760 | strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name)); |
| 761 | } else { |
| 762 | ALOGW("%s: Not an SDM439 device", __func__); |
| 763 | } |
| 764 | } |
| 765 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 766 | void *hw_info_init(const char *snd_card_name) |
| 767 | { |
| 768 | struct hardware_info *hw_info; |
| 769 | |
| 770 | hw_info = malloc(sizeof(struct hardware_info)); |
Haynes Mathew George | b51ceb1 | 2014-06-30 13:56:18 -0700 | [diff] [blame] | 771 | if (!hw_info) { |
| 772 | ALOGE("failed to allocate mem for hardware info"); |
| 773 | return NULL; |
| 774 | } |
| 775 | |
Vidyakumar Athota | b4dbbbe | 2014-03-06 14:34:40 -0800 | [diff] [blame] | 776 | hw_info->snd_devices = NULL; |
| 777 | hw_info->num_snd_devices = 0; |
Rohit kumar | d3c3b91 | 2016-11-15 18:50:31 +0530 | [diff] [blame] | 778 | hw_info->is_stereo_spkr = true; |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 779 | hw_info->is_wsa_combo_suppported = false; |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 780 | strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn)); |
| 781 | strlcpy(hw_info->type, "", sizeof(hw_info->type)); |
| 782 | strlcpy(hw_info->name, "", sizeof(hw_info->name)); |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 783 | |
| 784 | if(strstr(snd_card_name, "msm8974") || |
| 785 | strstr(snd_card_name, "apq8074")) { |
| 786 | ALOGV("8974 - variant soundcard"); |
| 787 | update_hardware_info_8974(hw_info, snd_card_name); |
| 788 | } else if(strstr(snd_card_name, "msm8226")) { |
| 789 | ALOGV("8x26 - variant soundcard"); |
| 790 | update_hardware_info_8226(hw_info, snd_card_name); |
| 791 | } else if(strstr(snd_card_name, "msm8x10")) { |
| 792 | ALOGV("8x10 - variant soundcard"); |
| 793 | update_hardware_info_8610(hw_info, snd_card_name); |
| 794 | } else if(strstr(snd_card_name, "apq8084")) { |
| 795 | ALOGV("8084 - variant soundcard"); |
| 796 | update_hardware_info_8084(hw_info, snd_card_name); |
Mingming Yin | 0e1b290 | 2014-05-19 18:20:59 -0700 | [diff] [blame] | 797 | } else if(strstr(snd_card_name, "msm8994")) { |
| 798 | ALOGV("8994 - variant soundcard"); |
| 799 | update_hardware_info_8994(hw_info, snd_card_name); |
Josh Kirsch | c389437 | 2016-03-28 15:59:48 -0700 | [diff] [blame] | 800 | } else if(strstr(snd_card_name, "apq8096")) { |
| 801 | ALOGV("8096 - variant soundcard"); |
| 802 | update_hardware_info_8096(hw_info, snd_card_name); |
Mingming Yin | 89c6a7f | 2015-03-24 11:56:14 -0700 | [diff] [blame] | 803 | } else if(strstr(snd_card_name, "msm8996")) { |
| 804 | ALOGV("8996 - variant soundcard"); |
| 805 | update_hardware_info_8996(hw_info, snd_card_name); |
Venkataraman Nerellapalli | b8689ec | 2017-05-04 11:55:29 +0530 | [diff] [blame] | 806 | } else if((strstr(snd_card_name, "msm8998")) || (strstr(snd_card_name, "apq8098_latv"))) { |
Ben Romberger | 22d4123 | 2016-11-16 14:55:25 -0800 | [diff] [blame] | 807 | ALOGV("MSM8998 - variant soundcard"); |
| 808 | update_hardware_info_msm8998(hw_info, snd_card_name); |
Xiaoyu Ye | 0afc923 | 2017-03-28 21:31:22 -0700 | [diff] [blame] | 809 | } else if(strstr(snd_card_name, "sdm845")) { |
| 810 | ALOGV("SDM845 - variant soundcard"); |
| 811 | update_hardware_info_sdm845(hw_info, snd_card_name); |
Naresh Tanniru | c21e202 | 2018-08-13 21:58:06 +0530 | [diff] [blame] | 812 | } else if (strstr(snd_card_name, "sdm660") || strstr(snd_card_name, "sdm670") |
Naresh Tanniru | cb5b578 | 2018-10-12 20:42:07 +0530 | [diff] [blame] | 813 | || strstr(snd_card_name, "sm6150") || strstr(snd_card_name, "qcs605-lc") |
Aditya Bavanari | 3c8e357 | 2018-12-18 16:44:16 +0530 | [diff] [blame] | 814 | || strstr(snd_card_name, "qcs405") || strstr(snd_card_name, "qcs605-ipc") |
Rahul Sharma | 093a4ad | 2018-12-26 16:53:51 +0530 | [diff] [blame] | 815 | || strstr(snd_card_name, "trinket") || strstr(snd_card_name, "sa6155")) { |
Preetam Singh Ranawat | d770a36 | 2017-05-24 19:07:15 +0530 | [diff] [blame] | 816 | ALOGV("Bear - variant soundcard"); |
| 817 | update_hardware_info_bear(hw_info, snd_card_name); |
Walter Yang | 558e113 | 2018-01-02 11:47:19 +0800 | [diff] [blame] | 818 | } else if (strstr(snd_card_name, "sdx")) { |
Xiaoyu Ye | c494c75 | 2017-11-02 18:52:48 -0700 | [diff] [blame] | 819 | ALOGV("SDX - variant soundcard"); |
| 820 | update_hardware_info_sdx(hw_info, snd_card_name); |
Derek Chen | 4d6f770 | 2018-07-07 14:04:27 -0700 | [diff] [blame] | 821 | } else if (strstr(snd_card_name, "pahu") || strstr(snd_card_name, "tavil") || |
| 822 | strstr(snd_card_name, "sa8155")) { |
Xiaoyu Ye | 91553e6 | 2017-11-21 17:35:50 -0800 | [diff] [blame] | 823 | ALOGV("MSMNILE - variant soundcard"); |
| 824 | update_hardware_info_msmnile(hw_info, snd_card_name); |
Josh Kirsch | f20adbf | 2018-03-06 16:26:22 -0800 | [diff] [blame] | 825 | } else if (strstr(snd_card_name, "sda845")) { |
| 826 | ALOGV("SDA845 - variant soundcard"); |
| 827 | update_hardware_info_sda845(hw_info, snd_card_name); |
Faiz Nabi Kuchay | 0b79d7d | 2019-08-05 20:36:31 +0530 | [diff] [blame] | 828 | } else if (strstr(snd_card_name, "kona") || strstr(snd_card_name, "lito") |
Harshal Ahire | 4637415 | 2019-10-22 11:37:12 +0530 | [diff] [blame] | 829 | || strstr(snd_card_name, "atoll") || strstr(snd_card_name, "bengal")) { |
Meng Wang | ef2f6e1 | 2018-10-08 13:06:05 +0800 | [diff] [blame] | 830 | ALOGV("KONA - variant soundcard"); |
| 831 | update_hardware_info_kona(hw_info, snd_card_name); |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 832 | } else if(strstr(snd_card_name, "sdm439")) { |
| 833 | ALOGV("SDM439 - variant soundcard"); |
| 834 | update_hardware_info_sdm439(hw_info, snd_card_name); |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 835 | } else { |
Mingming Yin | 834543b | 2013-12-30 15:52:43 -0800 | [diff] [blame] | 836 | ALOGE("%s: Unsupported target %s:",__func__, snd_card_name); |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 837 | free(hw_info); |
| 838 | hw_info = NULL; |
| 839 | } |
| 840 | |
| 841 | return hw_info; |
| 842 | } |
| 843 | |
| 844 | void hw_info_deinit(void *hw_info) |
| 845 | { |
| 846 | struct hardware_info *my_data = (struct hardware_info*) hw_info; |
| 847 | |
| 848 | if(!my_data) |
| 849 | free(my_data); |
| 850 | } |
| 851 | |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 852 | void hw_info_enable_wsa_combo_usecase_support(void *hw_info) |
| 853 | { |
| 854 | struct hardware_info *my_data = (struct hardware_info*) hw_info; |
| 855 | if(!my_data) { |
| 856 | ALOGE(" ERROR wsa combo update is called with invalid hw_info"); |
| 857 | return; |
| 858 | } |
| 859 | my_data->is_wsa_combo_suppported = true; |
| 860 | |
| 861 | } |
| 862 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 863 | void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device, |
| 864 | char *device_name) |
| 865 | { |
| 866 | struct hardware_info *my_data = (struct hardware_info*) hw_info; |
| 867 | uint32_t i = 0; |
| 868 | |
| 869 | snd_device_t *snd_devices = |
| 870 | (snd_device_t *) my_data->snd_devices; |
| 871 | |
Sujin Panicker | b904fbe | 2019-04-04 13:28:07 +0530 | [diff] [blame] | 872 | |
| 873 | if(my_data->is_wsa_combo_suppported) { |
| 874 | for (i = 0; i < ARRAY_SIZE(wsa_combo_devices) ; i++) { |
| 875 | if (snd_device == (snd_device_t)wsa_combo_devices[i]) { |
| 876 | char mixer_device_name[DEVICE_NAME_MAX_SIZE] = {0}; |
| 877 | ALOGD("appending wsa extension to device %s", |
| 878 | device_name); |
| 879 | strlcpy(mixer_device_name, WSA_MIXER_PATH_EXTENSION, |
| 880 | sizeof(WSA_MIXER_PATH_EXTENSION)) ; |
| 881 | strlcat(mixer_device_name, device_name, DEVICE_NAME_MAX_SIZE); |
| 882 | strlcpy(device_name, mixer_device_name, DEVICE_NAME_MAX_SIZE-1); |
| 883 | break; |
| 884 | } |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 889 | if(snd_devices != NULL) { |
| 890 | for (i = 0; i < my_data->num_snd_devices; i++) { |
| 891 | if (snd_device == (snd_device_t)snd_devices[i]) { |
| 892 | ALOGV("extract dev_extn device %d, extn = %s", |
| 893 | (snd_device_t)snd_devices[i], my_data->dev_extn); |
| 894 | CHECK(strlcat(device_name, my_data->dev_extn, |
| 895 | DEVICE_NAME_MAX_SIZE) < DEVICE_NAME_MAX_SIZE); |
| 896 | break; |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | ALOGD("%s : device_name = %s", __func__,device_name); |
| 901 | } |
Rohit kumar | d3c3b91 | 2016-11-15 18:50:31 +0530 | [diff] [blame] | 902 | |
| 903 | bool hw_info_is_stereo_spkr(void *hw_info) |
| 904 | { |
| 905 | struct hardware_info *my_data = (struct hardware_info*) hw_info; |
| 906 | |
| 907 | return my_data->is_stereo_spkr; |
| 908 | } |