• Home
  • Raw
  • Download

Lines Matching +full:out +full:- +full:mono

1 // SPDX-License-Identifier: GPL-2.0-only
17 * ---------------------------------------
18 * MONO_LOUT -> N/A | MONO_LOUT -> N/A
19 * | IN1L -> LINE1L
20 * | IN1R -> LINE1R
21 * | IN2L -> LINE2L
22 * | IN2R -> LINE2R
23 * | MIC3L/R -> N/A
26 * ---------------------------------------
93 /* Output Common-Mode Voltage */
165 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_dapm_put_volsw_aic3x()
166 unsigned int reg = mc->reg; in snd_soc_dapm_put_volsw_aic3x()
167 unsigned int shift = mc->shift; in snd_soc_dapm_put_volsw_aic3x()
168 int max = mc->max; in snd_soc_dapm_put_volsw_aic3x()
169 unsigned int mask = (1 << fls(max)) - 1; in snd_soc_dapm_put_volsw_aic3x()
170 unsigned int invert = mc->invert; in snd_soc_dapm_put_volsw_aic3x()
175 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_dapm_put_volsw_aic3x()
184 val = mask - val; in snd_soc_dapm_put_volsw_aic3x()
215 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in mic_bias_event()
223 aic3x->micbias_vg << MICBIAS_LEVEL_SHIFT); in mic_bias_event()
245 "differential of HPLOUT", "constant VCM", "single-ended" };
250 "differential of HPROUT", "constant VCM", "single-ended",
256 "single-ended", "differential" };
276 "-5.5dB", "-8dB", "-10dB", "-12dB",
277 "-14dB", "-17dB", "-20dB", "-24dB" };
308 * DAC digital volumes. From -63.5 to 0 dB in 0.5 dB steps
310 static DECLARE_TLV_DB_SCALE(dac_tlv, -6350, 50, 0);
314 * Output stage volumes. From -78.3 to 0 dB. Muted below -78.3 dB.
317 * Define dB scale so that it is mostly correct for range about -55 to 0 dB
319 * so much). This setting shows -50 dB (actual is -50.3 dB) for register
320 * value 100 and -58.5 dB (actual is -78.3 dB) for register value 117.
322 static DECLARE_TLV_DB_SCALE(output_stage_tlv, -5900, 50, 1);
334 * only for swapped L-to-R and R-to-L routes. See below stereo controls
335 * for direct L-to-L and R-to-R routes.
367 /* Stereo output controls for direct L-to-L and R-to-R routes */
415 /* De-emphasis */
416 SOC_DOUBLE("De-emphasis Switch", AIC3X_CODEC_DFILT_CTRL, 2, 0, 0x01, 0),
423 SOC_ENUM("ADC HPF Cut-off", aic3x_adc_hpf_enum),
426 SOC_ENUM("Output Driver Power-On time", aic3x_poweron_time_enum),
427 SOC_ENUM("Output Driver Ramp-up step", aic3x_rampup_step_enum),
434 * only for swapped L-to-R and R-to-L routes. See below stereo controls
435 * for direct L-to-L and R-to-R routes.
455 /* Stereo output controls for direct L-to-L and R-to-R routes */
470 SOC_DOUBLE_R_TLV("Mono Line2 Bypass Volume",
473 SOC_DOUBLE_R_TLV("Mono PGA Bypass Volume",
476 SOC_DOUBLE_R_TLV("Mono DAC Playback Volume",
480 SOC_SINGLE("Mono Playback Switch", MONOLOPM_CTRL, 3, 0x01, 0),
481 SOC_SINGLE_TLV("Mono Playback Volume", MONOLOPM_CTRL, 4, 9, 0,
487 * Class-D amplifier gain. From 0 to 18 dB in 6 dB steps
492 SOC_DOUBLE_TLV("Class-D Playback Volume", CLASSD_CTRL, 6, 4, 3, 0, classd_amp_tlv);
532 /* Mono Mixer */
647 SND_SOC_DAPM_PGA("Left Line Out", LLOPM_CTRL, 0, 0, NULL, 0),
648 SND_SOC_DAPM_PGA("Left HP Out", HPLOUT_CTRL, 0, 0, NULL, 0),
657 SND_SOC_DAPM_PGA("Right Line Out", RLOPM_CTRL, 0, 0, NULL, 0),
658 SND_SOC_DAPM_PGA("Right HP Out", HPROUT_CTRL, 0, 0, NULL, 0),
778 ARRAY_SIZE(aic3x_left_line_mixer_controls) - 2),
781 ARRAY_SIZE(aic3x_right_line_mixer_controls) - 2),
784 ARRAY_SIZE(aic3x_left_hp_mixer_controls) - 2),
787 ARRAY_SIZE(aic3x_right_hp_mixer_controls) - 2),
790 ARRAY_SIZE(aic3x_left_hpcom_mixer_controls) - 2),
793 ARRAY_SIZE(aic3x_right_hpcom_mixer_controls) - 2),
800 /* Mono Output */
801 SND_SOC_DAPM_PGA("Mono Out", MONOLOPM_CTRL, 0, 0, NULL, 0),
803 SND_SOC_DAPM_MIXER("Mono Mixer", SND_SOC_NOPM, 0, 0,
811 /* Class-D outputs */
812 SND_SOC_DAPM_PGA("Left Class-D Out", CLASSD_CTRL, 3, 0, NULL, 0),
813 SND_SOC_DAPM_PGA("Right Class-D Out", CLASSD_CTRL, 2, 0, NULL, 0),
821 {"Left Line1L Mux", "single-ended", "LINE1L"},
823 {"Left Line1R Mux", "single-ended", "LINE1R"},
832 {"Right Line1R Mux", "single-ended", "LINE1R"},
834 {"Right Line1L Mux", "single-ended", "LINE1L"},
858 {"Left Line Out", NULL, "Left Line Mixer"},
859 {"Left Line Out", NULL, "Left DAC Mux"},
860 {"LLOUT", NULL, "Left Line Out"},
868 {"Right Line Out", NULL, "Right Line Mixer"},
869 {"Right Line Out", NULL, "Right DAC Mux"},
870 {"RLOUT", NULL, "Right Line Out"},
878 {"Left HP Out", NULL, "Left HP Mixer"},
879 {"Left HP Out", NULL, "Left DAC Mux"},
880 {"HPLOUT", NULL, "Left HP Out"},
888 {"Right HP Out", NULL, "Right HP Mixer"},
889 {"Right HP Out", NULL, "Right DAC Mux"},
890 {"HPROUT", NULL, "Right HP Out"},
900 {"Left HPCOM Mux", "single-ended", "Left HPCOM Mixer"},
912 {"Right HPCOM Mux", "single-ended", "Right HPCOM Mixer"},
922 {"Left Line2L Mux", "single-ended", "LINE2L"},
932 {"Right Line2R Mux", "single-ended", "LINE2R"},
986 /* Mono Output */
987 {"Mono Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
988 {"Mono Mixer", "PGAL Bypass Switch", "Left PGA Mixer"},
989 {"Mono Mixer", "DACL1 Switch", "Left DAC Mux"},
990 {"Mono Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
991 {"Mono Mixer", "PGAR Bypass Switch", "Right PGA Mixer"},
992 {"Mono Mixer", "DACR1 Switch", "Right DAC Mux"},
993 {"Mono Out", NULL, "Mono Mixer"},
994 {"MONO_LOUT", NULL, "Mono Out"},
998 /* Class-D outputs */
999 {"Left Class-D Out", NULL, "Left Line Out"},
1000 {"Right Class-D Out", NULL, "Left Line Out"},
1001 {"SPOP", NULL, "Left Class-D Out"},
1002 {"SPOM", NULL, "Right Class-D Out"},
1010 switch (aic3x->model) { in aic3x_add_widgets()
1047 struct snd_soc_component *component = dai->component; in aic3x_hw_params()
1053 int width = aic3x->slot_width; in aic3x_hw_params()
1081 if (aic3x->sysclk / (128 * pll_q) == fsref) { in aic3x_hw_params()
1113 data -= 2; in aic3x_hw_params()
1126 codec_clk = (2048 * fsref) / (aic3x->sysclk / 1000); in aic3x_hw_params()
1140 if (abs(codec_clk - tmp_clk) < in aic3x_hw_params()
1141 abs(codec_clk - last_clk)) { in aic3x_hw_params()
1161 d = ((2048 * p * fsref) - j * aic3x->sysclk) in aic3x_hw_params()
1162 * 100 / (aic3x->sysclk/100); in aic3x_hw_params()
1168 if (abs(codec_clk - clk) < abs(codec_clk - last_clk)) { in aic3x_hw_params()
1180 return -EINVAL; in aic3x_hw_params()
1199 struct snd_soc_component *component = dai->component; in aic3x_prepare()
1202 int width = aic3x->slot_width; in aic3x_prepare()
1205 width = substream->runtime->sample_bits; in aic3x_prepare()
1208 if (aic3x->dai_fmt == SND_SOC_DAIFMT_DSP_A) in aic3x_prepare()
1209 delay += (aic3x->tdm_delay*width + 1); in aic3x_prepare()
1210 else if (aic3x->dai_fmt == SND_SOC_DAIFMT_DSP_B) in aic3x_prepare()
1211 delay += aic3x->tdm_delay*width; in aic3x_prepare()
1221 struct snd_soc_component *component = dai->component; in aic3x_mute()
1239 struct snd_soc_component *component = codec_dai->component; in aic3x_set_dai_sysclk()
1248 aic3x->sysclk = freq; in aic3x_set_dai_sysclk()
1255 struct snd_soc_component *component = codec_dai->component; in aic3x_set_dai_fmt()
1265 aic3x->master = 1; in aic3x_set_dai_fmt()
1269 aic3x->master = 0; in aic3x_set_dai_fmt()
1273 aic3x->master = 1; in aic3x_set_dai_fmt()
1278 aic3x->master = 1; in aic3x_set_dai_fmt()
1283 return -EINVAL; in aic3x_set_dai_fmt()
1305 return -EINVAL; in aic3x_set_dai_fmt()
1308 aic3x->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in aic3x_set_dai_fmt()
1321 struct snd_soc_component *component = codec_dai->component; in aic3x_set_dai_tdm_slot()
1326 dev_err(component->dev, "tx and rx masks must be symmetric\n"); in aic3x_set_dai_tdm_slot()
1327 return -EINVAL; in aic3x_set_dai_tdm_slot()
1331 dev_err(component->dev, "tx and rx masks need to be non 0\n"); in aic3x_set_dai_tdm_slot()
1332 return -EINVAL; in aic3x_set_dai_tdm_slot()
1338 dev_err(component->dev, "Invalid mask, slots must be adjacent\n"); in aic3x_set_dai_tdm_slot()
1339 return -EINVAL; in aic3x_set_dai_tdm_slot()
1349 dev_err(component->dev, "Unsupported slot width %d\n", slot_width); in aic3x_set_dai_tdm_slot()
1350 return -EINVAL; in aic3x_set_dai_tdm_slot()
1354 aic3x->tdm_delay = lsb; in aic3x_set_dai_tdm_slot()
1355 aic3x->slot_width = slot_width; in aic3x_set_dai_tdm_slot()
1357 /* DOUT in high-impedance on inactive bit clocks */ in aic3x_set_dai_tdm_slot()
1369 struct aic3x_priv *aic3x = disable_nb->aic3x; in aic3x_regulator_event()
1376 if (gpio_is_valid(aic3x->gpio_reset)) in aic3x_regulator_event()
1377 gpio_set_value(aic3x->gpio_reset, 0); in aic3x_regulator_event()
1378 regcache_mark_dirty(aic3x->regmap); in aic3x_regulator_event()
1391 ret = regulator_bulk_enable(ARRAY_SIZE(aic3x->supplies), in aic3x_set_power()
1392 aic3x->supplies); in aic3x_set_power()
1394 goto out; in aic3x_set_power()
1395 aic3x->power = 1; in aic3x_set_power()
1397 if (gpio_is_valid(aic3x->gpio_reset)) { in aic3x_set_power()
1399 gpio_set_value(aic3x->gpio_reset, 1); in aic3x_set_power()
1403 regcache_cache_only(aic3x->regmap, false); in aic3x_set_power()
1404 regcache_sync(aic3x->regmap); in aic3x_set_power()
1419 * Delay is needed to reduce pop-noise after syncing back the in aic3x_set_power()
1430 regcache_mark_dirty(aic3x->regmap); in aic3x_set_power()
1431 aic3x->power = 0; in aic3x_set_power()
1433 regcache_cache_only(aic3x->regmap, true); in aic3x_set_power()
1434 ret = regulator_bulk_disable(ARRAY_SIZE(aic3x->supplies), in aic3x_set_power()
1435 aic3x->supplies); in aic3x_set_power()
1437 out: in aic3x_set_power()
1451 aic3x->master) { in aic3x_set_bias_level()
1458 if (!aic3x->power) in aic3x_set_bias_level()
1461 aic3x->master) { in aic3x_set_bias_level()
1468 if (aic3x->power) in aic3x_set_bias_level()
1492 .name = "tlv320aic3x-hifi",
1511 /* DAC to Mono Line Out default volume and route to Output mixer */ in aic3x_mono_init()
1518 /* PGA to Mono Line Out default volume, disconnect from Output Mixer */ in aic3x_mono_init()
1522 /* Line2 to Mono Out default volume, disconnect from Output Mixer */ in aic3x_mono_init()
1547 /* DAC to Line Out default volume and route to Output mixer */ in aic3x_init()
1571 /* PGA to Line Out default volume, disconnect from Output Mixer */ in aic3x_init()
1576 if (aic3x->model != AIC3X_MODEL_3104) { in aic3x_init()
1582 /* Line2 Line Out default volume, disconnect from Output Mixer */ in aic3x_init()
1587 switch (aic3x->model) { in aic3x_init()
1597 /* Output common-mode voltage = 1.5 V */ in aic3x_init()
1599 aic3x->ocmv << HPOUT_SC_OCMV_SHIFT); in aic3x_init()
1609 if (gpio_is_valid(aic3x->gpio_reset) && in aic3x_is_shared_reset()
1610 aic3x->gpio_reset == a->gpio_reset) in aic3x_is_shared_reset()
1622 aic3x->component = component; in aic3x_probe()
1624 for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) { in aic3x_probe()
1625 aic3x->disable_nb[i].nb.notifier_call = aic3x_regulator_event; in aic3x_probe()
1626 aic3x->disable_nb[i].aic3x = aic3x; in aic3x_probe()
1628 aic3x->supplies[i].consumer, in aic3x_probe()
1629 &aic3x->disable_nb[i].nb); in aic3x_probe()
1631 dev_err(component->dev, in aic3x_probe()
1638 regcache_mark_dirty(aic3x->regmap); in aic3x_probe()
1641 if (aic3x->setup) { in aic3x_probe()
1642 if (aic3x->model != AIC3X_MODEL_3104) { in aic3x_probe()
1645 (aic3x->setup->gpio_func[0] & 0xf) << 4); in aic3x_probe()
1647 (aic3x->setup->gpio_func[1] & 0xf) << 4); in aic3x_probe()
1649 dev_warn(component->dev, "GPIO functionality is not supported on tlv320aic3104\n"); in aic3x_probe()
1653 switch (aic3x->model) { in aic3x_probe()
1672 switch (aic3x->micbias_vg) { in aic3x_probe()
1678 (aic3x->micbias_vg) << MICBIAS_LEVEL_SHIFT); in aic3x_probe()
1710 struct device_node *np = client->dev.of_node; in aic3x_configure_ocmv()
1715 if (np && !of_property_read_u32(np, "ai3x-ocmv", &value)) { in aic3x_configure_ocmv()
1718 aic3x->ocmv = value; in aic3x_configure_ocmv()
1723 dvdd = regulator_get_voltage(aic3x->supplies[1].consumer); in aic3x_configure_ocmv()
1724 avdd = regulator_get_voltage(aic3x->supplies[2].consumer); in aic3x_configure_ocmv()
1727 dev_warn(&client->dev, in aic3x_configure_ocmv()
1731 aic3x->ocmv = HPOUT_SC_OCMV_1_8V; in aic3x_configure_ocmv()
1733 aic3x->ocmv = HPOUT_SC_OCMV_1_65V; in aic3x_configure_ocmv()
1735 aic3x->ocmv = HPOUT_SC_OCMV_1_5V; in aic3x_configure_ocmv()
1737 aic3x->ocmv = HPOUT_SC_OCMV_1_35V; in aic3x_configure_ocmv()
1739 dev_warn(&client->dev, in aic3x_configure_ocmv()
1761 /* Class-D speaker driver init; datasheet p. 46 */
1777 struct aic3x_pdata *pdata = i2c->dev.platform_data; in aic3x_i2c_probe()
1780 struct device_node *np = i2c->dev.of_node; in aic3x_i2c_probe()
1784 aic3x = devm_kzalloc(&i2c->dev, sizeof(struct aic3x_priv), GFP_KERNEL); in aic3x_i2c_probe()
1786 return -ENOMEM; in aic3x_i2c_probe()
1788 aic3x->regmap = devm_regmap_init_i2c(i2c, &aic3x_regmap); in aic3x_i2c_probe()
1789 if (IS_ERR(aic3x->regmap)) { in aic3x_i2c_probe()
1790 ret = PTR_ERR(aic3x->regmap); in aic3x_i2c_probe()
1794 regcache_cache_only(aic3x->regmap, true); in aic3x_i2c_probe()
1798 aic3x->gpio_reset = pdata->gpio_reset; in aic3x_i2c_probe()
1799 aic3x->setup = pdata->setup; in aic3x_i2c_probe()
1800 aic3x->micbias_vg = pdata->micbias_vg; in aic3x_i2c_probe()
1802 ai3x_setup = devm_kzalloc(&i2c->dev, sizeof(*ai3x_setup), in aic3x_i2c_probe()
1805 return -ENOMEM; in aic3x_i2c_probe()
1807 ret = of_get_named_gpio(np, "reset-gpios", 0); in aic3x_i2c_probe()
1809 aic3x->gpio_reset = ret; in aic3x_i2c_probe()
1811 ret = of_get_named_gpio(np, "gpio-reset", 0); in aic3x_i2c_probe()
1813 dev_warn(&i2c->dev, "Using deprecated property \"gpio-reset\", please update your DT"); in aic3x_i2c_probe()
1814 aic3x->gpio_reset = ret; in aic3x_i2c_probe()
1816 aic3x->gpio_reset = -1; in aic3x_i2c_probe()
1820 if (of_property_read_u32_array(np, "ai3x-gpio-func", in aic3x_i2c_probe()
1821 ai3x_setup->gpio_func, 2) >= 0) { in aic3x_i2c_probe()
1822 aic3x->setup = ai3x_setup; in aic3x_i2c_probe()
1825 if (!of_property_read_u32(np, "ai3x-micbias-vg", &value)) { in aic3x_i2c_probe()
1828 aic3x->micbias_vg = AIC3X_MICBIAS_2_0V; in aic3x_i2c_probe()
1831 aic3x->micbias_vg = AIC3X_MICBIAS_2_5V; in aic3x_i2c_probe()
1834 aic3x->micbias_vg = AIC3X_MICBIAS_AVDDV; in aic3x_i2c_probe()
1837 aic3x->micbias_vg = AIC3X_MICBIAS_OFF; in aic3x_i2c_probe()
1838 dev_err(&i2c->dev, "Unsuitable MicBias voltage " in aic3x_i2c_probe()
1842 aic3x->micbias_vg = AIC3X_MICBIAS_OFF; in aic3x_i2c_probe()
1846 aic3x->gpio_reset = -1; in aic3x_i2c_probe()
1849 aic3x->model = id->driver_data; in aic3x_i2c_probe()
1851 if (gpio_is_valid(aic3x->gpio_reset) && in aic3x_i2c_probe()
1853 ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset"); in aic3x_i2c_probe()
1856 gpio_direction_output(aic3x->gpio_reset, 0); in aic3x_i2c_probe()
1859 for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) in aic3x_i2c_probe()
1860 aic3x->supplies[i].supply = aic3x_supply_names[i]; in aic3x_i2c_probe()
1862 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(aic3x->supplies), in aic3x_i2c_probe()
1863 aic3x->supplies); in aic3x_i2c_probe()
1865 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); in aic3x_i2c_probe()
1871 if (aic3x->model == AIC3X_MODEL_3007) { in aic3x_i2c_probe()
1872 ret = regmap_register_patch(aic3x->regmap, aic3007_class_d, in aic3x_i2c_probe()
1875 dev_err(&i2c->dev, "Failed to init class D: %d\n", in aic3x_i2c_probe()
1879 ret = devm_snd_soc_register_component(&i2c->dev, in aic3x_i2c_probe()
1885 INIT_LIST_HEAD(&aic3x->list); in aic3x_i2c_probe()
1886 list_add(&aic3x->list, &reset_list); in aic3x_i2c_probe()
1891 if (gpio_is_valid(aic3x->gpio_reset) && in aic3x_i2c_probe()
1893 gpio_free(aic3x->gpio_reset); in aic3x_i2c_probe()
1902 list_del(&aic3x->list); in aic3x_i2c_remove()
1904 if (gpio_is_valid(aic3x->gpio_reset) && in aic3x_i2c_remove()
1906 gpio_set_value(aic3x->gpio_reset, 0); in aic3x_i2c_remove()
1907 gpio_free(aic3x->gpio_reset); in aic3x_i2c_remove()
1927 .name = "tlv320aic3x-codec",