Lines Matching +full:pga +full:- +full:gain
34 /* Gain and Volume */
36 /* -54dB */
37 0x0, 0x11, TLV_DB_SCALE_ITEM(-5400, 0, 0),
38 /* -52.5dB to 15dB */
39 0x12, 0x3f, TLV_DB_SCALE_ITEM(-5250, 150, 0)
44 /* -78dB to 12dB */
45 0x08, 0x7f, TLV_DB_SCALE_ITEM(-7800, 75, 0)
54 static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0);
55 static const DECLARE_TLV_DB_SCALE(mixin_gain_tlv, -450, 150, 0);
56 static const DECLARE_TLV_DB_SCALE(eq_gain_tlv, -1050, 150, 0);
57 static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -5700, 100, 0);
58 static const DECLARE_TLV_DB_SCALE(lineout_vol_tlv, -4800, 100, 0);
59 static const DECLARE_TLV_DB_SCALE(alc_threshold_tlv, -9450, 150, 0);
92 /* Gain ramping rate value */
238 offset_l = -avg_left_data; in da7213_alc_calib_man()
239 offset_r = -avg_right_data; in da7213_alc_calib_man()
251 /* Enable analog/digital gain mode & offset cancellation */ in da7213_alc_calib_man()
268 /* If auto calibration fails, fall back to digital gain only mode */ in da7213_alc_calib_auto()
270 dev_warn(component->dev, in da7213_alc_calib_auto()
276 /* Enable analog/digital gain mode & offset cancellation */ in da7213_alc_calib_auto()
328 if (da7213->alc_calib_auto) in da7213_alc_calib()
356 if ((!ret) && (da7213->alc_en)) in da7213_put_mixin_gain()
369 if (ucontrol->value.integer.value[0] || in da7213_put_alc_sw()
370 ucontrol->value.integer.value[1]) { in da7213_put_alc_sw()
371 if (!da7213->alc_en) { in da7213_put_alc_sw()
373 da7213->alc_en = true; in da7213_put_alc_sw()
376 da7213->alc_en = false; in da7213_put_alc_sw()
399 SOC_DOUBLE_R_EXT_TLV("Mixin PGA Volume", DA7213_MIXIN_L_GAIN,
460 SOC_DOUBLE_R("Mixin PGA Switch", DA7213_MIXIN_L_CTRL,
477 SOC_DOUBLE_R("Mixin PGA ZC Switch", DA7213_MIXIN_L_CTRL,
483 /* Gain Ramping controls */
484 SOC_DOUBLE_R("Aux Gain Ramping Switch", DA7213_AUX_L_CTRL,
487 SOC_DOUBLE_R("Mixin Gain Ramping Switch", DA7213_MIXIN_L_CTRL,
490 SOC_DOUBLE_R("ADC Gain Ramping Switch", DA7213_ADC_L_CTRL,
493 SOC_DOUBLE_R("DAC Gain Ramping Switch", DA7213_DAC_L_CTRL,
496 SOC_DOUBLE_R("Headphone Gain Ramping Switch", DA7213_HP_L_CTRL,
499 SOC_SINGLE("Lineout Gain Ramping Switch", DA7213_LINE_CTRL,
502 SOC_ENUM("Gain Ramping Rate", da7213_gain_ramp_rate),
560 SOC_SINGLE_TLV("ALC Max Gain Volume", DA7213_ALC_GAIN_LIMITS,
563 SOC_SINGLE_TLV("ALC Min Analog Gain Volume", DA7213_ALC_ANA_GAIN_LIMITS,
566 SOC_SINGLE_TLV("ALC Max Analog Gain Volume", DA7213_ALC_ANA_GAIN_LIMITS,
586 /* MIC PGA source select */
738 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in da7213_dai_event()
747 if (da7213->master) in da7213_dai_event()
780 dev_warn(component->dev, "SRM failed to lock\n"); in da7213_dai_event()
792 /* PC free-running */ in da7213_dai_event()
798 if (da7213->master) in da7213_dai_event()
803 return -EINVAL; in da7213_dai_event()
832 /* MUXs for Mic PGA source selection */
839 SND_SOC_DAPM_PGA("Mic 1 PGA", DA7213_MIC_1_CTRL, DA7213_AMP_EN_SHIFT,
841 SND_SOC_DAPM_PGA("Mic 2 PGA", DA7213_MIC_2_CTRL, DA7213_AMP_EN_SHIFT,
843 SND_SOC_DAPM_PGA("Aux Left PGA", DA7213_AUX_L_CTRL, DA7213_AMP_EN_SHIFT,
845 SND_SOC_DAPM_PGA("Aux Right PGA", DA7213_AUX_R_CTRL,
847 SND_SOC_DAPM_PGA("Mixin Left PGA", DA7213_MIXIN_L_CTRL,
849 SND_SOC_DAPM_PGA("Mixin Right PGA", DA7213_MIXIN_R_CTRL,
909 SND_SOC_DAPM_PGA("Mixout Left PGA", DA7213_MIXOUT_L_CTRL,
911 SND_SOC_DAPM_PGA("Mixout Right PGA", DA7213_MIXOUT_R_CTRL,
913 SND_SOC_DAPM_PGA("Lineout PGA", DA7213_LINE_CTRL, DA7213_AMP_EN_SHIFT,
915 SND_SOC_DAPM_PGA("Headphone Left PGA", DA7213_HP_L_CTRL,
917 SND_SOC_DAPM_PGA("Headphone Right PGA", DA7213_HP_R_CTRL,
950 {"Mic 1 PGA", NULL, "Mic 1 Amp Source MUX"},
951 {"Mic 2 PGA", NULL, "Mic 2 Amp Source MUX"},
953 {"Aux Left PGA", NULL, "AUXL"},
954 {"Aux Right PGA", NULL, "AUXR"},
956 {"Mixin Left", "Aux Left Switch", "Aux Left PGA"},
957 {"Mixin Left", "Mic 1 Switch", "Mic 1 PGA"},
958 {"Mixin Left", "Mic 2 Switch", "Mic 2 PGA"},
959 {"Mixin Left", "Mixin Right Switch", "Mixin Right PGA"},
961 {"Mixin Right", "Aux Right Switch", "Aux Right PGA"},
962 {"Mixin Right", "Mic 2 Switch", "Mic 2 PGA"},
963 {"Mixin Right", "Mic 1 Switch", "Mic 1 PGA"},
964 {"Mixin Right", "Mixin Left Switch", "Mixin Left PGA"},
966 {"Mixin Left PGA", NULL, "Mixin Left"},
967 {"ADC Left", NULL, "Mixin Left PGA"},
969 {"Mixin Right PGA", NULL, "Mixin Right"},
970 {"ADC Right", NULL, "Mixin Right PGA"},
1005 {"Mixout Left", "Aux Left Switch", "Aux Left PGA"},
1006 {"Mixout Left", "Mixin Left Switch", "Mixin Left PGA"},
1007 {"Mixout Left", "Mixin Right Switch", "Mixin Right PGA"},
1009 {"Mixout Left", "Aux Left Invert Switch", "Aux Left PGA"},
1010 {"Mixout Left", "Mixin Left Invert Switch", "Mixin Left PGA"},
1011 {"Mixout Left", "Mixin Right Invert Switch", "Mixin Right PGA"},
1013 {"Mixout Right", "Aux Right Switch", "Aux Right PGA"},
1014 {"Mixout Right", "Mixin Right Switch", "Mixin Right PGA"},
1015 {"Mixout Right", "Mixin Left Switch", "Mixin Left PGA"},
1017 {"Mixout Right", "Aux Right Invert Switch", "Aux Right PGA"},
1018 {"Mixout Right", "Mixin Right Invert Switch", "Mixin Right PGA"},
1019 {"Mixout Right", "Mixin Left Invert Switch", "Mixin Left PGA"},
1021 {"Mixout Left PGA", NULL, "Mixout Left"},
1022 {"Mixout Right PGA", NULL, "Mixout Right"},
1024 {"Headphone Left PGA", NULL, "Mixout Left PGA"},
1025 {"Headphone Left PGA", NULL, "Charge Pump"},
1026 {"HPL", NULL, "Headphone Left PGA"},
1028 {"Headphone Right PGA", NULL, "Mixout Right PGA"},
1029 {"Headphone Right PGA", NULL, "Charge Pump"},
1030 {"HPR", NULL, "Headphone Right PGA"},
1032 {"Lineout PGA", NULL, "Mixout Right PGA"},
1033 {"LINE", NULL, "Lineout PGA"},
1153 struct snd_soc_component *component = dai->component; in da7213_hw_params()
1172 return -EINVAL; in da7213_hw_params()
1208 return -EINVAL; in da7213_hw_params()
1220 struct snd_soc_component *component = codec_dai->component; in da7213_set_dai_fmt()
1228 da7213->master = true; in da7213_set_dai_fmt()
1231 da7213->master = false; in da7213_set_dai_fmt()
1234 return -EINVAL; in da7213_set_dai_fmt()
1256 return -EINVAL; in da7213_set_dai_fmt()
1276 return -EINVAL; in da7213_set_dai_fmt()
1280 return -EINVAL; in da7213_set_dai_fmt()
1302 return -EINVAL; in da7213_set_dai_fmt()
1318 struct snd_soc_component *component = dai->component; in da7213_mute()
1341 struct snd_soc_component *component = codec_dai->component; in da7213_set_dai_sysclk()
1345 if ((da7213->clk_src == clk_id) && (da7213->mclk_rate == freq)) in da7213_set_dai_sysclk()
1349 dev_err(codec_dai->dev, "Unsupported MCLK value %d\n", in da7213_set_dai_sysclk()
1351 return -EINVAL; in da7213_set_dai_sysclk()
1365 dev_err(codec_dai->dev, "Unknown clock source %d\n", clk_id); in da7213_set_dai_sysclk()
1366 return -EINVAL; in da7213_set_dai_sysclk()
1369 da7213->clk_src = clk_id; in da7213_set_dai_sysclk()
1371 if (da7213->mclk) { in da7213_set_dai_sysclk()
1372 freq = clk_round_rate(da7213->mclk, freq); in da7213_set_dai_sysclk()
1373 ret = clk_set_rate(da7213->mclk, freq); in da7213_set_dai_sysclk()
1375 dev_err(codec_dai->dev, "Failed to set clock rate %d\n", in da7213_set_dai_sysclk()
1381 da7213->mclk_rate = freq; in da7213_set_dai_sysclk()
1386 /* Supported PLL input frequencies are 32KHz, 5MHz - 54MHz. */
1390 struct snd_soc_component *component = codec_dai->component; in da7213_set_dai_pll()
1399 if (da7213->mclk_rate == 32768) { in da7213_set_dai_pll()
1400 if (!da7213->master) { in da7213_set_dai_pll()
1401 dev_err(component->dev, in da7213_set_dai_pll()
1403 return -EINVAL; in da7213_set_dai_pll()
1413 if (da7213->mclk_rate < 5000000) { in da7213_set_dai_pll()
1414 dev_err(component->dev, in da7213_set_dai_pll()
1416 da7213->mclk_rate); in da7213_set_dai_pll()
1417 return -EINVAL; in da7213_set_dai_pll()
1418 } else if (da7213->mclk_rate <= 9000000) { in da7213_set_dai_pll()
1421 } else if (da7213->mclk_rate <= 18000000) { in da7213_set_dai_pll()
1424 } else if (da7213->mclk_rate <= 36000000) { in da7213_set_dai_pll()
1427 } else if (da7213->mclk_rate <= 54000000) { in da7213_set_dai_pll()
1431 dev_err(component->dev, in da7213_set_dai_pll()
1433 da7213->mclk_rate); in da7213_set_dai_pll()
1434 return -EINVAL; in da7213_set_dai_pll()
1436 freq_ref = (da7213->mclk_rate / indiv); in da7213_set_dai_pll()
1455 if (da7213->mclk_rate != 32768) { in da7213_set_dai_pll()
1456 dev_err(component->dev, in da7213_set_dai_pll()
1458 return -EINVAL; in da7213_set_dai_pll()
1465 dev_err(component->dev, "Invalid PLL config\n"); in da7213_set_dai_pll()
1466 return -EINVAL; in da7213_set_dai_pll()
1508 .name = "da7213-hifi",
1541 if (da7213->mclk) { in da7213_set_bias_level()
1542 ret = clk_prepare_enable(da7213->mclk); in da7213_set_bias_level()
1544 dev_err(component->dev, in da7213_set_bias_level()
1559 if (da7213->mclk) in da7213_set_bias_level()
1560 clk_disable_unprepare(da7213->mclk); in da7213_set_bias_level()
1603 dev_warn(component->dev, "Invalid micbias level\n"); in da7213_of_micbias_lvl()
1616 dev_warn(component->dev, "Invalid DMIC data select type\n"); in da7213_of_dmic_data_sel()
1629 dev_warn(component->dev, "Invalid DMIC sample phase\n"); in da7213_of_dmic_samplephase()
1643 dev_warn(component->dev, "Invalid DMIC clock rate\n"); in da7213_of_dmic_clkrate()
1651 struct device *dev = component->dev; in da7213_fw_to_pdata()
1656 pdata = devm_kzalloc(component->dev, sizeof(*pdata), GFP_KERNEL); in da7213_fw_to_pdata()
1660 if (device_property_read_u32(dev, "dlg,micbias1-lvl", &fw_val32) >= 0) in da7213_fw_to_pdata()
1661 pdata->micbias1_lvl = da7213_of_micbias_lvl(component, fw_val32); in da7213_fw_to_pdata()
1663 pdata->micbias1_lvl = DA7213_MICBIAS_2_2V; in da7213_fw_to_pdata()
1665 if (device_property_read_u32(dev, "dlg,micbias2-lvl", &fw_val32) >= 0) in da7213_fw_to_pdata()
1666 pdata->micbias2_lvl = da7213_of_micbias_lvl(component, fw_val32); in da7213_fw_to_pdata()
1668 pdata->micbias2_lvl = DA7213_MICBIAS_2_2V; in da7213_fw_to_pdata()
1670 if (!device_property_read_string(dev, "dlg,dmic-data-sel", &fw_str)) in da7213_fw_to_pdata()
1671 pdata->dmic_data_sel = da7213_of_dmic_data_sel(component, fw_str); in da7213_fw_to_pdata()
1673 pdata->dmic_data_sel = DA7213_DMIC_DATA_LRISE_RFALL; in da7213_fw_to_pdata()
1675 if (!device_property_read_string(dev, "dlg,dmic-samplephase", &fw_str)) in da7213_fw_to_pdata()
1676 pdata->dmic_samplephase = in da7213_fw_to_pdata()
1679 pdata->dmic_samplephase = DA7213_DMIC_SAMPLE_ON_CLKEDGE; in da7213_fw_to_pdata()
1681 if (device_property_read_u32(dev, "dlg,dmic-clkrate", &fw_val32) >= 0) in da7213_fw_to_pdata()
1682 pdata->dmic_clk_rate = da7213_of_dmic_clkrate(component, fw_val32); in da7213_fw_to_pdata()
1684 pdata->dmic_clk_rate = DA7213_DMIC_CLK_3_0MHZ; in da7213_fw_to_pdata()
1697 da7213->alc_calib_auto = true; in da7213_probe()
1699 /* Default PC counter to free-running */ in da7213_probe()
1703 /* Enable all Gain Ramps */ in da7213_probe()
1754 da7213->pdata = dev_get_platdata(component->dev); in da7213_probe()
1755 if (!da7213->pdata) in da7213_probe()
1756 da7213->pdata = da7213_fw_to_pdata(component); in da7213_probe()
1759 if (da7213->pdata) { in da7213_probe()
1760 struct da7213_platform_data *pdata = da7213->pdata; in da7213_probe()
1764 switch (pdata->micbias1_lvl) { in da7213_probe()
1769 micbias_lvl |= (pdata->micbias1_lvl << in da7213_probe()
1773 switch (pdata->micbias2_lvl) { in da7213_probe()
1778 micbias_lvl |= (pdata->micbias2_lvl << in da7213_probe()
1787 switch (pdata->dmic_data_sel) { in da7213_probe()
1790 dmic_cfg |= (pdata->dmic_data_sel << in da7213_probe()
1794 switch (pdata->dmic_samplephase) { in da7213_probe()
1797 dmic_cfg |= (pdata->dmic_samplephase << in da7213_probe()
1801 switch (pdata->dmic_clk_rate) { in da7213_probe()
1804 dmic_cfg |= (pdata->dmic_clk_rate << in da7213_probe()
1815 da7213->mclk = devm_clk_get(component->dev, "mclk"); in da7213_probe()
1816 if (IS_ERR(da7213->mclk)) { in da7213_probe()
1817 if (PTR_ERR(da7213->mclk) != -ENOENT) in da7213_probe()
1818 return PTR_ERR(da7213->mclk); in da7213_probe()
1820 da7213->mclk = NULL; in da7213_probe()
1857 da7213 = devm_kzalloc(&i2c->dev, sizeof(*da7213), GFP_KERNEL); in da7213_i2c_probe()
1859 return -ENOMEM; in da7213_i2c_probe()
1863 da7213->regmap = devm_regmap_init_i2c(i2c, &da7213_regmap_config); in da7213_i2c_probe()
1864 if (IS_ERR(da7213->regmap)) { in da7213_i2c_probe()
1865 ret = PTR_ERR(da7213->regmap); in da7213_i2c_probe()
1866 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); in da7213_i2c_probe()
1870 ret = devm_snd_soc_register_component(&i2c->dev, in da7213_i2c_probe()
1873 dev_err(&i2c->dev, "Failed to register da7213 component: %d\n", in da7213_i2c_probe()