Lines Matching +full:boost +full:- +full:bypass
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
25 #include "adau-utils.h"
324 0, 7, TLV_DB_SCALE_ITEM(-7900, 400, 1),
325 8, 15, TLV_DB_SCALE_ITEM(-4700, 300, 0),
326 16, 23, TLV_DB_SCALE_ITEM(-2300, 200, 0),
327 24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0)
330 static const DECLARE_TLV_DB_MINMAX(adau1373_digital_tlv, -9563, 0);
331 static const DECLARE_TLV_DB_SCALE(adau1373_in_pga_tlv, -1300, 100, 1);
332 static const DECLARE_TLV_DB_SCALE(adau1373_ep_tlv, -600, 600, 1);
384 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1),
417 1, 7, TLV_DB_LINEAR_ITEM(-1800, -120)
478 SOC_DOUBLE_TLV("AIF3 Boost Playback Volume", ADAU1373_VOL_GAIN1, 4, 5,
480 SOC_DOUBLE_TLV("AIF2 Boost Playback Volume", ADAU1373_VOL_GAIN1, 2, 3,
482 SOC_DOUBLE_TLV("AIF1 Boost Playback Volume", ADAU1373_VOL_GAIN1, 0, 1,
484 SOC_DOUBLE_TLV("AIF3 Boost Capture Volume", ADAU1373_VOL_GAIN2, 4, 5,
486 SOC_DOUBLE_TLV("AIF2 Boost Capture Volume", ADAU1373_VOL_GAIN2, 2, 3,
488 SOC_DOUBLE_TLV("AIF1 Boost Capture Volume", ADAU1373_VOL_GAIN2, 0, 1,
490 SOC_DOUBLE_TLV("DMIC Boost Capture Volume", ADAU1373_VOL_GAIN3, 6, 7,
492 SOC_DOUBLE_TLV("ADC Boost Capture Volume", ADAU1373_VOL_GAIN3, 4, 5,
494 SOC_DOUBLE_TLV("DAC2 Boost Playback Volume", ADAU1373_VOL_GAIN3, 2, 3,
496 SOC_DOUBLE_TLV("DAC1 Boost Playback Volume", ADAU1373_VOL_GAIN3, 0, 1,
499 SOC_DOUBLE_TLV("Input 1 Boost Capture Volume", ADAU1373_ADC_GAIN, 0, 4,
501 SOC_DOUBLE_TLV("Input 2 Boost Capture Volume", ADAU1373_ADC_GAIN, 1, 5,
503 SOC_DOUBLE_TLV("Input 3 Boost Capture Volume", ADAU1373_ADC_GAIN, 2, 6,
505 SOC_DOUBLE_TLV("Input 4 Boost Capture Volume", ADAU1373_ADC_GAIN, 3, 7,
508 SOC_DOUBLE_TLV("Speaker Boost Playback Volume", ADAU1373_LS_CTRL, 2, 3,
551 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in adau1373_pll_event()
553 unsigned int pll_id = w->name[3] - '1'; in adau1373_pll_event()
561 regmap_update_bits(adau1373->regmap, ADAU1373_PLL_CTRL6(pll_id), in adau1373_pll_event()
603 SOC_DAPM_SINGLE("Input 4 Bypass Switch", _reg, 3, 1, 0), \
604 SOC_DAPM_SINGLE("Input 3 Bypass Switch", _reg, 2, 1, 0), \
605 SOC_DAPM_SINGLE("Input 2 Bypass Switch", _reg, 1, 1, 0), \
606 SOC_DAPM_SINGLE("Input 1 Bypass Switch", _reg, 0, 1, 0), \
627 SOC_DAPM_SINGLE("Input 4 Bypass Switch", ADAU1373_LHP_MIX, 3, 1, 0),
628 SOC_DAPM_SINGLE("Input 3 Bypass Switch", ADAU1373_LHP_MIX, 2, 1, 0),
629 SOC_DAPM_SINGLE("Input 2 Bypass Switch", ADAU1373_LHP_MIX, 1, 1, 0),
630 SOC_DAPM_SINGLE("Input 1 Bypass Switch", ADAU1373_LHP_MIX, 0, 1, 0),
636 SOC_DAPM_SINGLE("Input 4 Bypass Switch", ADAU1373_RHP_MIX, 3, 1, 0),
637 SOC_DAPM_SINGLE("Input 3 Bypass Switch", ADAU1373_RHP_MIX, 2, 1, 0),
638 SOC_DAPM_SINGLE("Input 2 Bypass Switch", ADAU1373_RHP_MIX, 1, 1, 0),
639 SOC_DAPM_SINGLE("Input 1 Bypass Switch", ADAU1373_RHP_MIX, 0, 1, 0),
823 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in adau1373_check_aif_clk()
828 dai = sink->name[3] - '1'; in adau1373_check_aif_clk()
830 if (!adau1373->dais[dai].master) in adau1373_check_aif_clk()
833 if (adau1373->dais[dai].clk_src == ADAU1373_CLK_SRC_PLL1) in adau1373_check_aif_clk()
838 return strcmp(source->name, clk) == 0; in adau1373_check_aif_clk()
844 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in adau1373_check_src()
848 dai = sink->name[3] - '1'; in adau1373_check_src()
850 return adau1373->dais[dai].enable_src; in adau1373_check_src()
874 { _sink, "Input 1 Bypass Switch", "IN1PGA" }, \
875 { _sink, "Input 2 Bypass Switch", "IN2PGA" }, \
876 { _sink, "Input 3 Bypass Switch", "IN3PGA" }, \
877 { _sink, "Input 4 Bypass Switch", "IN4PGA" }
884 { _sink, "Input 1 Bypass Switch", "IN1PGA" }, \
885 { _sink, "Input 2 Bypass Switch", "IN2PGA" }, \
886 { _sink, "Input 3 Bypass Switch", "IN3PGA" }, \
887 { _sink, "Input 4 Bypass Switch", "IN4PGA" }
938 { "Left Headphone Mixer", "Input 1 Bypass Switch", "IN1PGA" },
939 { "Left Headphone Mixer", "Input 2 Bypass Switch", "IN2PGA" },
940 { "Left Headphone Mixer", "Input 3 Bypass Switch", "IN3PGA" },
941 { "Left Headphone Mixer", "Input 4 Bypass Switch", "IN4PGA" },
944 { "Right Headphone Mixer", "Input 1 Bypass Switch", "IN1PGA" },
945 { "Right Headphone Mixer", "Input 2 Bypass Switch", "IN2PGA" },
946 { "Right Headphone Mixer", "Input 3 Bypass Switch", "IN3PGA" },
947 { "Right Headphone Mixer", "Input 4 Bypass Switch", "IN4PGA" },
956 { "Earpiece Mixer", "Input 1 Bypass Switch", "IN1PGA" },
957 { "Earpiece Mixer", "Input 2 Bypass Switch", "IN2PGA" },
958 { "Earpiece Mixer", "Input 3 Bypass Switch", "IN3PGA" },
959 { "Earpiece Mixer", "Input 4 Bypass Switch", "IN4PGA" },
1033 struct snd_soc_component *component = dai->component; in adau1373_hw_params()
1035 struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; in adau1373_hw_params()
1040 freq = adau1373_dai->sysclk; in adau1373_hw_params()
1043 return -EINVAL; in adau1373_hw_params()
1068 return -EINVAL; in adau1373_hw_params()
1071 adau1373_dai->enable_src = (div != 0); in adau1373_hw_params()
1073 regmap_update_bits(adau1373->regmap, ADAU1373_BCLKDIV(dai->id), in adau1373_hw_params()
1091 return -EINVAL; in adau1373_hw_params()
1094 return regmap_update_bits(adau1373->regmap, ADAU1373_DAI(dai->id), in adau1373_hw_params()
1100 struct snd_soc_component *component = dai->component; in adau1373_set_dai_fmt()
1102 struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; in adau1373_set_dai_fmt()
1108 adau1373_dai->master = true; in adau1373_set_dai_fmt()
1112 adau1373_dai->master = false; in adau1373_set_dai_fmt()
1115 return -EINVAL; in adau1373_set_dai_fmt()
1132 return -EINVAL; in adau1373_set_dai_fmt()
1148 return -EINVAL; in adau1373_set_dai_fmt()
1151 regmap_update_bits(adau1373->regmap, ADAU1373_DAI(dai->id), in adau1373_set_dai_fmt()
1160 struct adau1373 *adau1373 = snd_soc_component_get_drvdata(dai->component); in adau1373_set_dai_sysclk()
1161 struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; in adau1373_set_dai_sysclk()
1168 return -EINVAL; in adau1373_set_dai_sysclk()
1171 adau1373_dai->sysclk = freq; in adau1373_set_dai_sysclk()
1172 adau1373_dai->clk_src = clk_id; in adau1373_set_dai_sysclk()
1174 regmap_update_bits(adau1373->regmap, ADAU1373_BCLKDIV(dai->id), in adau1373_set_dai_sysclk()
1192 .name = "adau1373-aif1",
1212 .name = "adau1373-aif2",
1232 .name = "adau1373-aif3",
1265 return -EINVAL; in adau1373_set_pll()
1283 return -EINVAL; in adau1373_set_pll()
1287 return -EINVAL; in adau1373_set_pll()
1290 return -EINVAL; in adau1373_set_pll()
1301 return -EINVAL; in adau1373_set_pll()
1304 dpll_div = 11 - dpll_div; in adau1373_set_pll()
1305 regmap_update_bits(adau1373->regmap, ADAU1373_PLL_CTRL6(pll_id), in adau1373_set_pll()
1308 regmap_update_bits(adau1373->regmap, ADAU1373_PLL_CTRL6(pll_id), in adau1373_set_pll()
1313 regmap_write(adau1373->regmap, ADAU1373_DPLL_CTRL(pll_id), in adau1373_set_pll()
1315 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL1(pll_id), pll_regs[0]); in adau1373_set_pll()
1316 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL2(pll_id), pll_regs[1]); in adau1373_set_pll()
1317 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL3(pll_id), pll_regs[2]); in adau1373_set_pll()
1318 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL4(pll_id), pll_regs[3]); in adau1373_set_pll()
1319 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL5(pll_id), pll_regs[4]); in adau1373_set_pll()
1322 regmap_update_bits(adau1373->regmap, ADAU1373_CLK_SRC_DIV(pll_id), 0x3f, 0x09); in adau1373_set_pll()
1333 regmap_write(adau1373->regmap, ADAU1373_DRC(nr) + i, drc[i]); in adau1373_load_drc_settings()
1353 struct adau1373_platform_data *pdata = component->dev->platform_data; in adau1373_probe()
1359 if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting)) in adau1373_probe()
1360 return -EINVAL; in adau1373_probe()
1362 if (!adau1373_valid_micbias(pdata->micbias1) || in adau1373_probe()
1363 !adau1373_valid_micbias(pdata->micbias2)) in adau1373_probe()
1364 return -EINVAL; in adau1373_probe()
1366 for (i = 0; i < pdata->num_drc; ++i) { in adau1373_probe()
1368 pdata->drc_setting[i]); in adau1373_probe()
1372 pdata->num_drc); in adau1373_probe()
1376 if (pdata->input_differential[i]) in adau1373_probe()
1379 regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val); in adau1373_probe()
1382 if (pdata->lineout_differential) in adau1373_probe()
1384 if (pdata->lineout_ground_sense) in adau1373_probe()
1386 regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val); in adau1373_probe()
1388 lineout_differential = pdata->lineout_differential; in adau1373_probe()
1390 regmap_write(adau1373->regmap, ADAU1373_EP_CTRL, in adau1373_probe()
1391 (pdata->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) | in adau1373_probe()
1392 (pdata->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET)); in adau1373_probe()
1400 regmap_write(adau1373->regmap, ADAU1373_ADC_CTRL, in adau1373_probe()
1417 regmap_update_bits(adau1373->regmap, ADAU1373_PWDN_CTRL3, in adau1373_set_bias_level()
1421 regmap_update_bits(adau1373->regmap, ADAU1373_PWDN_CTRL3, in adau1373_set_bias_level()
1432 regcache_sync(adau1373->regmap); in adau1373_resume()
1482 adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL); in adau1373_i2c_probe()
1484 return -ENOMEM; in adau1373_i2c_probe()
1486 adau1373->regmap = devm_regmap_init_i2c(client, in adau1373_i2c_probe()
1488 if (IS_ERR(adau1373->regmap)) in adau1373_i2c_probe()
1489 return PTR_ERR(adau1373->regmap); in adau1373_i2c_probe()
1491 regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00); in adau1373_i2c_probe()
1493 dev_set_drvdata(&client->dev, adau1373); in adau1373_i2c_probe()
1495 ret = devm_snd_soc_register_component(&client->dev, in adau1373_i2c_probe()
1518 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");