Lines Matching +full:headset +full:- +full:mic +full:- +full:bias +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2012
8 * for ST-Ericsson.
14 * for ST-Ericsson.
29 #include <linux/mfd/abx500/ab8500-sysctrl.h>
30 #include <linux/mfd/abx500/ab8500-codec.h>
39 #include <sound/soc-dapm.h>
42 #include "ab8500-codec.h"
56 /* Nr of FIR/IIR-coeff banks in ANC-block */
114 /* Private data for AB8500 device-driver */
157 /* Read a register from the audio-bank of AB8500 */
172 /* Write to a register in the audio-bank of AB8500 */
188 * Controls - DAPM
194 static const char * const enum_ear_lineout_source[] = {"Headset Left",
215 /* Speaker Left - ANC selector */
223 /* Speaker Right - ANC selector */
230 /* Mic 1 */
232 /* Mic 1 - Mic 1a or 1b selector */
233 static const char * const enum_mic1ab_sel[] = {"Mic 1b", "Mic 1a"};
237 SOC_DAPM_ENUM("Mic 1a or 1b Select", dapm_enum_mic1ab_sel),
240 /* Mic 1 - AD3 - Mic 1 or DMic 3 selector */
241 static const char * const enum_ad3_sel[] = {"Mic 1", "DMic 3"};
248 /* Mic 1 - AD6 - Mic 1 or DMic 6 selector */
249 static const char * const enum_ad6_sel[] = {"Mic 1", "DMic 6"};
256 /* Mic 2 */
258 /* Mic 2 - AD5 - Mic 2 or DMic 5 selector */
259 static const char * const enum_ad5_sel[] = {"Mic 2", "DMic 5"};
268 /* LineIn left - AD1 - LineIn Left or DMic 1 selector */
276 /* LineIn right - Mic 2 or LineIn Right selector */
277 static const char * const enum_mic2lr_sel[] = {"Mic 2", "LineIn Right"};
281 SOC_DAPM_ENUM("Mic 2 or LINR Select", dapm_enum_mic2lr_sel),
284 /* LineIn right - AD2 - LineIn Right or DMic2 selector */
295 static const char * const enum_anc_in_sel[] = {"Mic 1 / DMic 6",
296 "Mic 2 / DMic 5"};
303 /* ANC - Enable/Disable */
309 /* ANC to Earpiece - Mute */
319 /* Sidetone left - Input selector */
321 "LineIn Left", "LineIn Right", "Mic 1", "Headset Left"
331 /* Sidetone right - Input selector */
333 "LineIn Right", "Mic 1", "DMic 4", "Headset Right"
360 * DAPM-widgets
369 SND_SOC_DAPM_REGULATOR_SUPPLY("V-AUD", 0, 0),
370 SND_SOC_DAPM_REGULATOR_SUPPLY("V-AMIC1", 0, 0),
371 SND_SOC_DAPM_REGULATOR_SUPPLY("V-AMIC2", 0, 0),
372 SND_SOC_DAPM_REGULATOR_SUPPLY("V-DMIC", 0, 0),
382 /* Main supply node */
383 SND_SOC_DAPM_SUPPLY("Main Supply", SND_SOC_NOPM, 0, 0,
407 /* Headset path */
456 SND_SOC_DAPM_OUTPUT("Headset Left"),
457 SND_SOC_DAPM_OUTPUT("Headset Right"),
562 /* Mic 1 */
564 SND_SOC_DAPM_INPUT("Mic 1"),
566 SND_SOC_DAPM_MUX("Mic 1a or 1b Select",
571 SND_SOC_DAPM_MIXER("MIC1A V-AMICx Enable",
574 SND_SOC_DAPM_MIXER("MIC1B V-AMICx Enable",
589 /* Mic 2 */
591 SND_SOC_DAPM_INPUT("Mic 2"),
596 SND_SOC_DAPM_MIXER("MIC2 V-AMICx Enable", AB8500_ANACONF2,
626 /* LineIn, Mic 2 */
627 SND_SOC_DAPM_MUX("Mic 2 or LINR Select",
741 * DAPM-routes
744 /* Power AB8500 audio-block when AD/DA is active */
745 {"Main Supply", NULL, "V-AUD"},
746 {"Main Supply", NULL, "audioclk"},
747 {"Main Supply", NULL, "Audio Power"},
748 {"Main Supply", NULL, "Audio Analog Power"},
751 {"DAC", NULL, "Main Supply"},
753 {"ADC", NULL, "Main Supply"},
756 {"ANC Configure Input", NULL, "Main Supply"},
770 /* Headset path */
796 {"Headset Left", NULL, "HSL Volume"},
797 {"Headset Right", NULL, "HSR Volume"},
825 {"Earpiece or LineOut Mono Source", "Headset Left",
880 /* Mic 2 */
882 {"MIC2 V-AMICx Enable", NULL, "Mic 2"},
891 /* LineIn, Mic 2 */
892 {"Mic 2 or LINR Select", "LineIn Right", "LINR Enable"},
893 {"Mic 2 or LINR Select", "Mic 2", "MIC2 V-AMICx Enable"},
896 {"LINR ADC", NULL, "Mic 2 or LINR Select"},
912 /* Mic 1 */
914 {"MIC1 Mute", NULL, "Mic 1"},
916 {"MIC1A V-AMICx Enable", NULL, "MIC1 Mute"},
917 {"MIC1B V-AMICx Enable", NULL, "MIC1 Mute"},
919 {"Mic 1a or 1b Select", "Mic 1a", "MIC1A V-AMICx Enable"},
920 {"Mic 1a or 1b Select", "Mic 1b", "MIC1B V-AMICx Enable"},
922 {"MIC1 ADC", NULL, "Mic 1a or 1b Select"},
924 {"AD3 Source Select", "Mic 1", "MIC1 ADC"},
935 {"AD5 Source Select", "Mic 2", "LINR ADC"},
936 {"AD6 Source Select", "Mic 1", "MIC1 ADC"},
951 {"DMic 1", NULL, "V-DMIC"},
952 {"DMic 2", NULL, "V-DMIC"},
953 {"DMic 3", NULL, "V-DMIC"},
954 {"DMic 4", NULL, "V-DMIC"},
955 {"DMic 5", NULL, "V-DMIC"},
956 {"DMic 6", NULL, "V-DMIC"},
980 {"ANC Source", "Mic 2 / DMic 5", "AD5 Channel Volume"},
981 {"ANC Source", "Mic 1 / DMic 6", "AD6 Channel Volume"},
995 {"Sidetone Left Source", "Mic 1", "AD3 Enable"},
996 {"Sidetone Left Source", "Headset Left", "DA_IN1"},
998 {"Sidetone Right Source", "Mic 1", "AD3 Enable"},
1000 {"Sidetone Right Source", "Headset Right", "DA_IN2"},
1013 {"MIC1A V-AMICx Enable", NULL, "V-AMIC1"},
1014 {"MIC1A V-AMICx Enable", NULL, "V-AMIC2"},
1018 {"MIC1B V-AMICx Enable", NULL, "V-AMIC1"},
1019 {"MIC1B V-AMICx Enable", NULL, "V-AMIC2"},
1023 {"MIC2 V-AMICx Enable", NULL, "V-AMIC1"},
1024 {"MIC2 V-AMICx Enable", NULL, "V-AMIC2"},
1027 /* ANC FIR-coefficients configuration sequence */
1039 if (par == AB8500_ANC_FIR_COEFFS - 1 && bnk == 1) in anc_fir()
1044 /* ANC IIR-coefficients configuration sequence */
1070 if (par == AB8500_ANC_IIR_COEFFS - 1 && bnk == 1) in anc_iir()
1075 /* ANC IIR-/FIR-coefficients configuration sequence */
1079 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); in anc_configure()
1082 dev_dbg(component->dev, "%s: Enter.\n", __func__); in anc_configure()
1095 drvdata->anc_fir_values[par]); in anc_configure()
1103 drvdata->anc_iir_values[par]); in anc_configure()
1107 dev_dbg(component->dev, "%s: Exit.\n", __func__); in anc_configure()
1111 * Control-events
1118 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); in sid_status_control_get()
1120 mutex_lock(&drvdata->ctrl_lock); in sid_status_control_get()
1121 ucontrol->value.enumerated.item[0] = drvdata->sid_status; in sid_status_control_get()
1122 mutex_unlock(&drvdata->ctrl_lock); in sid_status_control_get()
1127 /* Write sidetone FIR-coefficients configuration sequence */
1132 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); in sid_status_control_put()
1136 dev_dbg(component->dev, "%s: Enter\n", __func__); in sid_status_control_put()
1138 if (ucontrol->value.enumerated.item[0] != SID_APPLY_FIR) { in sid_status_control_put()
1139 dev_err(component->dev, in sid_status_control_put()
1142 return -EIO; in sid_status_control_put()
1145 mutex_lock(&drvdata->ctrl_lock); in sid_status_control_put()
1150 dev_err(component->dev, "%s: Sidetone busy while off!\n", in sid_status_control_put()
1152 status = -EPERM; in sid_status_control_put()
1154 status = -EBUSY; in sid_status_control_put()
1162 val = snd_soc_component_read(component, drvdata->sid_fir_values[param]); in sid_status_control_put()
1173 drvdata->sid_status = SID_FIR_CONFIGURED; in sid_status_control_put()
1176 mutex_unlock(&drvdata->ctrl_lock); in sid_status_control_put()
1178 dev_dbg(component->dev, "%s: Exit\n", __func__); in sid_status_control_put()
1187 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); in anc_status_control_get()
1189 mutex_lock(&drvdata->ctrl_lock); in anc_status_control_get()
1190 ucontrol->value.enumerated.item[0] = drvdata->anc_status; in anc_status_control_get()
1191 mutex_unlock(&drvdata->ctrl_lock); in anc_status_control_get()
1201 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); in anc_status_control_put()
1202 struct device *dev = component->dev; in anc_status_control_put()
1209 mutex_lock(&drvdata->ctrl_lock); in anc_status_control_put()
1211 req = ucontrol->value.enumerated.item[0]; in anc_status_control_put()
1213 status = -EINVAL; in anc_status_control_put()
1220 status = -EINVAL; in anc_status_control_put()
1238 if (drvdata->anc_status == ANC_IIR_CONFIGURED) in anc_status_control_put()
1239 drvdata->anc_status = ANC_FIR_IIR_CONFIGURED; in anc_status_control_put()
1240 else if (drvdata->anc_status != ANC_FIR_IIR_CONFIGURED) in anc_status_control_put()
1241 drvdata->anc_status = ANC_FIR_CONFIGURED; in anc_status_control_put()
1244 if (drvdata->anc_status == ANC_FIR_CONFIGURED) in anc_status_control_put()
1245 drvdata->anc_status = ANC_FIR_IIR_CONFIGURED; in anc_status_control_put()
1246 else if (drvdata->anc_status != ANC_FIR_IIR_CONFIGURED) in anc_status_control_put()
1247 drvdata->anc_status = ANC_IIR_CONFIGURED; in anc_status_control_put()
1254 mutex_unlock(&drvdata->ctrl_lock); in anc_status_control_put()
1269 (struct filter_control *)kcontrol->private_value; in filter_control_info()
1271 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in filter_control_info()
1272 uinfo->count = fc->count; in filter_control_info()
1273 uinfo->value.integer.min = fc->min; in filter_control_info()
1274 uinfo->value.integer.max = fc->max; in filter_control_info()
1285 (struct filter_control *)kcontrol->private_value; in filter_control_get()
1288 mutex_lock(&drvdata->ctrl_lock); in filter_control_get()
1289 for (i = 0; i < fc->count; i++) in filter_control_get()
1290 ucontrol->value.integer.value[i] = fc->value[i]; in filter_control_get()
1291 mutex_unlock(&drvdata->ctrl_lock); in filter_control_get()
1302 (struct filter_control *)kcontrol->private_value; in filter_control_put()
1305 mutex_lock(&drvdata->ctrl_lock); in filter_control_put()
1306 for (i = 0; i < fc->count; i++) in filter_control_put()
1307 fc->value[i] = ucontrol->value.integer.value[i]; in filter_control_put()
1308 mutex_unlock(&drvdata->ctrl_lock); in filter_control_put()
1314 * Controls - Non-DAPM ASoC
1317 static DECLARE_TLV_DB_SCALE(adx_dig_gain_tlv, -3200, 100, 1);
1318 /* -32dB = Mute */
1320 static DECLARE_TLV_DB_SCALE(dax_dig_gain_tlv, -6300, 100, 1);
1321 /* -63dB = Mute */
1323 static DECLARE_TLV_DB_SCALE(hs_ear_dig_gain_tlv, -100, 100, 1);
1324 /* -1dB = Mute */
1327 0, 3, TLV_DB_SCALE_ITEM(-3200, 400, 0),
1328 4, 15, TLV_DB_SCALE_ITEM(-1800, 200, 0)
1333 static DECLARE_TLV_DB_SCALE(lin_gain_tlv, -1000, 200, 0);
1335 static DECLARE_TLV_DB_SCALE(lin2hs_gain_tlv, -3800, 200, 1);
1336 /* -38dB = Mute */
1410 /* Digital interface - DA from slot mapping */
1468 /* Digital interface - AD to slot mapping */
1582 /* Digital interface - Burst mode */
1614 /* Headset */
1615 SOC_ENUM("Headset Mode", soc_enum_da12voice),
1616 SOC_SINGLE("Headset High Pass Switch",
1619 SOC_SINGLE("Headset Low Power Switch",
1622 SOC_SINGLE("Headset DAC Low Power Switch",
1625 SOC_SINGLE("Headset DAC Drv Low Power Switch",
1628 SOC_ENUM("Headset Fade Speed", soc_enum_hsfadspeed),
1629 SOC_ENUM("Headset Source", soc_enum_da2hslr),
1630 SOC_ENUM("Headset Filter", soc_enum_hsesinc),
1631 SOC_DOUBLE_R_TLV("Headset Master Volume",
1634 SOC_DOUBLE_R_TLV("Headset Digital Volume",
1637 SOC_DOUBLE_TLV("Headset Volume",
1650 SOC_SINGLE("HF and Headset Swap Switch",
1709 /* Mic 1, Mic 2, LineIn */
1710 SOC_DOUBLE_R_TLV("Mic Master Volume",
1714 /* Mic 1 */
1715 SOC_SINGLE_TLV("Mic 1",
1719 SOC_SINGLE("Mic 1 Low Power Switch",
1723 /* Mic 2 */
1724 SOC_DOUBLE("Mic High Pass Switch",
1728 SOC_ENUM("Mic Mode", soc_enum_ad34voice),
1729 SOC_ENUM("Mic Filter", soc_enum_dmic34sinc),
1730 SOC_SINGLE_TLV("Mic 2",
1734 SOC_SINGLE("Mic 2 Low Power Switch",
1752 SOC_DOUBLE_R_TLV("LineIn to Headset Volume",
1772 /* Digital interface - DA from slot mapping */
1782 /* Digital interface - AD to slot mapping */
1816 /* Digital interface - Loopback */
1842 /* Digital interface - Burst FIFO */
1847 SOC_ENUM("Burst FIFO Bit-clock Frequency", soc_enum_bfifo19m2),
1857 SOC_SINGLE("Burst FIFO FS Extra Bit-clocks",
1914 * Extended interface for codec-driver
1921 dev_dbg(component->dev, "%s: Enter.\n", __func__); in ab8500_audio_init_audioblock()
1923 /* Reset audio-registers and disable 32kHz-clock output 2 */ in ab8500_audio_init_audioblock()
1943 dev_dbg(component->dev, "%s: Enter.\n", __func__); in ab8500_audio_setup_mics()
1945 /* Set DMic-clocks to outputs */ in ab8500_audio_setup_mics()
1946 status = abx500_get_register_interruptible(component->dev, AB8500_MISC, in ab8500_audio_setup_mics()
1953 status = abx500_set_register_interruptible(component->dev, in ab8500_audio_setup_mics()
1960 /* Attach regulators to AMic DAPM-paths */ in ab8500_audio_setup_mics()
1961 dev_dbg(component->dev, "%s: Mic 1a regulator: %s\n", __func__, in ab8500_audio_setup_mics()
1962 amic_micbias_str(amics->mic1a_micbias)); in ab8500_audio_setup_mics()
1963 route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; in ab8500_audio_setup_mics()
1965 dev_dbg(component->dev, "%s: Mic 1b regulator: %s\n", __func__, in ab8500_audio_setup_mics()
1966 amic_micbias_str(amics->mic1b_micbias)); in ab8500_audio_setup_mics()
1967 route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; in ab8500_audio_setup_mics()
1969 dev_dbg(component->dev, "%s: Mic 2 regulator: %s\n", __func__, in ab8500_audio_setup_mics()
1970 amic_micbias_str(amics->mic2_micbias)); in ab8500_audio_setup_mics()
1971 route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; in ab8500_audio_setup_mics()
1974 dev_err(component->dev, in ab8500_audio_setup_mics()
1975 "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", in ab8500_audio_setup_mics()
1980 /* Set AMic-configuration */ in ab8500_audio_setup_mics()
1981 dev_dbg(component->dev, "%s: Mic 1 mic-type: %s\n", __func__, in ab8500_audio_setup_mics()
1982 amic_type_str(amics->mic1_type)); in ab8500_audio_setup_mics()
1984 amics->mic1_type == AMIC_TYPE_DIFFERENTIAL ? in ab8500_audio_setup_mics()
1986 dev_dbg(component->dev, "%s: Mic 2 mic-type: %s\n", __func__, in ab8500_audio_setup_mics()
1987 amic_type_str(amics->mic2_type)); in ab8500_audio_setup_mics()
1989 amics->mic2_type == AMIC_TYPE_DIFFERENTIAL ? in ab8500_audio_setup_mics()
2014 dev_err(component->dev, in ab8500_audio_set_ear_cmv()
2015 "%s: Unknown earpiece CM-voltage (%d)!\n", in ab8500_audio_set_ear_cmv()
2017 return -EINVAL; in ab8500_audio_set_ear_cmv()
2019 dev_dbg(component->dev, "%s: Earpiece CM-voltage: %s\n", __func__, in ab8500_audio_set_ear_cmv()
2031 struct snd_soc_component *component = dai->component; in ab8500_audio_set_bit_delay()
2043 dev_err(dai->component->dev, in ab8500_audio_set_bit_delay()
2044 "%s: ERROR: Unsupported bit-delay (0x%x)!\n", in ab8500_audio_set_bit_delay()
2046 return -EINVAL; in ab8500_audio_set_bit_delay()
2049 dev_dbg(dai->component->dev, "%s: IF0 Bit-delay: %d bits.\n", in ab8500_audio_set_bit_delay()
2070 dev_dbg(component->dev, "%s: IF0 Clock is continuous.\n", in ab8500_codec_set_dai_clock_gate()
2075 dev_dbg(component->dev, "%s: IF0 Clock is gated.\n", in ab8500_codec_set_dai_clock_gate()
2079 dev_err(component->dev, in ab8500_codec_set_dai_clock_gate()
2082 return -EINVAL; in ab8500_codec_set_dai_clock_gate()
2094 struct snd_soc_component *component = dai->component; in ab8500_codec_set_dai_fmt()
2097 dev_dbg(component->dev, "%s: Enter (fmt = 0x%x)\n", __func__, fmt); in ab8500_codec_set_dai_fmt()
2107 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2108 "%s: IF0 Master-mode: AB8500 provider.\n", __func__); in ab8500_codec_set_dai_fmt()
2112 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2113 "%s: IF0 Master-mode: AB8500 consumer.\n", __func__); in ab8500_codec_set_dai_fmt()
2117 dev_err(dai->component->dev, in ab8500_codec_set_dai_fmt()
2122 dev_err(dai->component->dev, in ab8500_codec_set_dai_fmt()
2125 return -EINVAL; in ab8500_codec_set_dai_fmt()
2133 dev_err(dai->component->dev, in ab8500_codec_set_dai_fmt()
2149 dev_dbg(dai->component->dev, "%s: IF0 Protocol: I2S\n", __func__); in ab8500_codec_set_dai_fmt()
2155 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2162 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2169 dev_err(dai->component->dev, in ab8500_codec_set_dai_fmt()
2172 return -EINVAL; in ab8500_codec_set_dai_fmt()
2177 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2182 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2188 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2194 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_fmt()
2201 dev_err(dai->component->dev, in ab8500_codec_set_dai_fmt()
2204 return -EINVAL; in ab8500_codec_set_dai_fmt()
2216 struct snd_soc_component *component = dai->component; in ab8500_codec_set_dai_tdm_slot()
2237 dev_err(dai->component->dev, "%s: Unsupported slot-width 0x%x\n", in ab8500_codec_set_dai_tdm_slot()
2239 return -EINVAL; in ab8500_codec_set_dai_tdm_slot()
2242 dev_dbg(dai->component->dev, "%s: IF0 slot-width: %d bits.\n", in ab8500_codec_set_dai_tdm_slot()
2247 dev_dbg(dai->component->dev, "%s: Slots, total: %d\n", __func__, slots); in ab8500_codec_set_dai_tdm_slot()
2265 dev_err(dai->component->dev, in ab8500_codec_set_dai_tdm_slot()
2268 return -EINVAL; in ab8500_codec_set_dai_tdm_slot()
2275 return -EINVAL; in ab8500_codec_set_dai_tdm_slot()
2281 dev_dbg(dai->component->dev, "%s: Slots, active, TX: %d\n", __func__, in ab8500_codec_set_dai_tdm_slot()
2303 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_tdm_slot()
2304 "%s: In 8-channel mode DA-from-slot mapping is set manually.", in ab8500_codec_set_dai_tdm_slot()
2308 dev_err(dai->component->dev, in ab8500_codec_set_dai_tdm_slot()
2309 "%s: Unsupported number of active TX-slots (%d)!\n", in ab8500_codec_set_dai_tdm_slot()
2311 return -EINVAL; in ab8500_codec_set_dai_tdm_slot()
2314 /* Setup TDM AD according to active RX-slots */ in ab8500_codec_set_dai_tdm_slot()
2317 return -EINVAL; in ab8500_codec_set_dai_tdm_slot()
2322 dev_dbg(dai->component->dev, "%s: Slots, active, RX: %d\n", __func__, in ab8500_codec_set_dai_tdm_slot()
2347 dev_dbg(dai->component->dev, in ab8500_codec_set_dai_tdm_slot()
2348 "%s: In 8-channel mode AD-to-slot mapping is set manually.", in ab8500_codec_set_dai_tdm_slot()
2352 dev_err(dai->component->dev, in ab8500_codec_set_dai_tdm_slot()
2353 "%s: Unsupported number of active RX-slots (%d)!\n", in ab8500_codec_set_dai_tdm_slot()
2355 return -EINVAL; in ab8500_codec_set_dai_tdm_slot()
2368 .name = "ab8500-codec-dai.0",
2381 .name = "ab8500-codec-dai.1",
2400 if (of_property_read_bool(np, "stericsson,amic1-type-single-ended")) in ab8500_codec_of_probe()
2401 codec->amics.mic1_type = AMIC_TYPE_SINGLE_ENDED; in ab8500_codec_of_probe()
2403 codec->amics.mic1_type = AMIC_TYPE_DIFFERENTIAL; in ab8500_codec_of_probe()
2405 if (of_property_read_bool(np, "stericsson,amic2-type-single-ended")) in ab8500_codec_of_probe()
2406 codec->amics.mic2_type = AMIC_TYPE_SINGLE_ENDED; in ab8500_codec_of_probe()
2408 codec->amics.mic2_type = AMIC_TYPE_DIFFERENTIAL; in ab8500_codec_of_probe()
2410 /* Has a non-standard Vamic been requested? */ in ab8500_codec_of_probe()
2411 if (of_property_read_bool(np, "stericsson,amic1a-bias-vamic2")) in ab8500_codec_of_probe()
2412 codec->amics.mic1a_micbias = AMIC_MICBIAS_VAMIC2; in ab8500_codec_of_probe()
2414 codec->amics.mic1a_micbias = AMIC_MICBIAS_VAMIC1; in ab8500_codec_of_probe()
2416 if (of_property_read_bool(np, "stericsson,amic1b-bias-vamic2")) in ab8500_codec_of_probe()
2417 codec->amics.mic1b_micbias = AMIC_MICBIAS_VAMIC2; in ab8500_codec_of_probe()
2419 codec->amics.mic1b_micbias = AMIC_MICBIAS_VAMIC1; in ab8500_codec_of_probe()
2421 if (of_property_read_bool(np, "stericsson,amic2-bias-vamic1")) in ab8500_codec_of_probe()
2422 codec->amics.mic2_micbias = AMIC_MICBIAS_VAMIC1; in ab8500_codec_of_probe()
2424 codec->amics.mic2_micbias = AMIC_MICBIAS_VAMIC2; in ab8500_codec_of_probe()
2426 if (!of_property_read_u32(np, "stericsson,earpeice-cmv", &value)) { in ab8500_codec_of_probe()
2429 codec->ear_cmv = EAR_CMV_0_95V; in ab8500_codec_of_probe()
2432 codec->ear_cmv = EAR_CMV_1_10V; in ab8500_codec_of_probe()
2435 codec->ear_cmv = EAR_CMV_1_27V; in ab8500_codec_of_probe()
2438 codec->ear_cmv = EAR_CMV_1_58V; in ab8500_codec_of_probe()
2441 codec->ear_cmv = EAR_CMV_UNKNOWN; in ab8500_codec_of_probe()
2445 dev_warn(dev, "No earpiece voltage found in DT - using default\n"); in ab8500_codec_of_probe()
2446 codec->ear_cmv = EAR_CMV_0_95V; in ab8500_codec_of_probe()
2453 struct device *dev = component->dev; in ab8500_codec_probe()
2454 struct device_node *np = dev->of_node; in ab8500_codec_probe()
2471 pr_err("%s: Failed to set earpiece CM-voltage (%d)!\n", in ab8500_codec_probe()
2478 dev_err(dev, "%s: failed to init audio-block (%d)!\n", in ab8500_codec_probe()
2483 /* Override HW-defaults */ in ab8500_codec_probe()
2500 drvdata->anc_fir_values = (long *)fc->value; in ab8500_codec_probe()
2503 drvdata->anc_iir_values = (long *)fc->value; in ab8500_codec_probe()
2506 drvdata->sid_fir_values = (long *)fc->value; in ab8500_codec_probe()
2510 mutex_init(&drvdata->ctrl_lock); in ab8500_codec_probe()
2533 dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); in ab8500_codec_driver_probe()
2535 /* Create driver private-data struct */ in ab8500_codec_driver_probe()
2536 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_codec_drvdata), in ab8500_codec_driver_probe()
2539 return -ENOMEM; in ab8500_codec_driver_probe()
2540 drvdata->sid_status = SID_UNCONFIGURED; in ab8500_codec_driver_probe()
2541 drvdata->anc_status = ANC_UNCONFIGURED; in ab8500_codec_driver_probe()
2542 dev_set_drvdata(&pdev->dev, drvdata); in ab8500_codec_driver_probe()
2544 drvdata->regmap = devm_regmap_init(&pdev->dev, NULL, &pdev->dev, in ab8500_codec_driver_probe()
2546 if (IS_ERR(drvdata->regmap)) { in ab8500_codec_driver_probe()
2547 status = PTR_ERR(drvdata->regmap); in ab8500_codec_driver_probe()
2548 dev_err(&pdev->dev, "%s: Failed to allocate regmap: %d\n", in ab8500_codec_driver_probe()
2553 dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__); in ab8500_codec_driver_probe()
2554 status = devm_snd_soc_register_component(&pdev->dev, in ab8500_codec_driver_probe()
2559 dev_err(&pdev->dev, in ab8500_codec_driver_probe()
2568 .name = "ab8500-codec",