Lines Matching +full:adc +full:- +full:freq

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
24 #include "adau-utils.h"
323 0, 7, TLV_DB_SCALE_ITEM(-7900, 400, 1),
324 8, 15, TLV_DB_SCALE_ITEM(-4700, 300, 0),
325 16, 23, TLV_DB_SCALE_ITEM(-2300, 200, 0),
326 24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0)
329 static const DECLARE_TLV_DB_MINMAX(adau1373_digital_tlv, -9563, 0);
330 static const DECLARE_TLV_DB_SCALE(adau1373_in_pga_tlv, -1300, 100, 1);
331 static const DECLARE_TLV_DB_SCALE(adau1373_ep_tlv, -600, 600, 1);
383 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1),
416 1, 7, TLV_DB_LINEAR_ITEM(-1800, -120)
441 SOC_DOUBLE_R_TLV("ADC Capture Volume", ADAU1373_ADC_RECL_VOL,
491 SOC_DOUBLE_TLV("ADC Boost Capture Volume", ADAU1373_VOL_GAIN3, 4, 5,
525 SOC_ENUM("3D Freq", adau1373_3d_cutoff_enum),
550 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in adau1373_pll_event()
552 unsigned int pll_id = w->name[3] - '1'; in adau1373_pll_event()
560 regmap_update_bits(adau1373->regmap, ADAU1373_PLL_CTRL6(pll_id), in adau1373_pll_event()
570 "ADC",
645 SOC_DAPM_SINGLE("ADC/DMIC1 Swapped Switch", _reg, 4, 1, 0), \
646 SOC_DAPM_SINGLE("ADC/DMIC1 Switch", _reg, 3, 1, 0), \
684 /* Datasheet claims Left ADC is bit 6 and Right ADC is bit 7, but that
686 SND_SOC_DAPM_ADC("Left ADC", NULL, ADAU1373_PWDN_CTRL1, 7, 0),
687 SND_SOC_DAPM_ADC("Right ADC", NULL, ADAU1373_PWDN_CTRL1, 6, 0),
708 SOC_MIXER_ARRAY("Left ADC Mixer", SND_SOC_NOPM, 0, 0,
710 SOC_MIXER_ARRAY("Right ADC Mixer", SND_SOC_NOPM, 0, 0,
822 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in adau1373_check_aif_clk()
827 dai = sink->name[3] - '1'; in adau1373_check_aif_clk()
829 if (!adau1373->dais[dai].clock_provider) in adau1373_check_aif_clk()
832 if (adau1373->dais[dai].clk_src == ADAU1373_CLK_SRC_PLL1) in adau1373_check_aif_clk()
843 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in adau1373_check_src()
847 dai = sink->name[3] - '1'; in adau1373_check_src()
849 return adau1373->dais[dai].enable_src; in adau1373_check_src()
855 { _sink, "ADC/DMIC1 Swapped Switch", "Decimator Mux" }, \
856 { _sink, "ADC/DMIC1 Switch", "Decimator Mux" }, \
889 { "Left ADC Mixer", "DAC1 Switch", "Left DAC1" },
890 { "Left ADC Mixer", "Input 1 Switch", "IN1PGA" },
891 { "Left ADC Mixer", "Input 2 Switch", "IN2PGA" },
892 { "Left ADC Mixer", "Input 3 Switch", "IN3PGA" },
893 { "Left ADC Mixer", "Input 4 Switch", "IN4PGA" },
895 { "Right ADC Mixer", "DAC1 Switch", "Right DAC1" },
896 { "Right ADC Mixer", "Input 1 Switch", "IN1PGA" },
897 { "Right ADC Mixer", "Input 2 Switch", "IN2PGA" },
898 { "Right ADC Mixer", "Input 3 Switch", "IN3PGA" },
899 { "Right ADC Mixer", "Input 4 Switch", "IN4PGA" },
901 { "Left ADC", NULL, "Left ADC Mixer" },
902 { "Right ADC", NULL, "Right ADC Mixer" },
904 { "Decimator Mux", "ADC", "Left ADC" },
905 { "Decimator Mux", "ADC", "Right ADC" },
986 { "Left ADC", NULL, "SYSCLK1" },
987 { "Right ADC", NULL, "SYSCLK1" },
998 { "Left ADC Mixer", NULL, "Recording Engine A" },
999 { "Right ADC Mixer", NULL, "Recording Engine A" },
1032 struct snd_soc_component *component = dai->component; in adau1373_hw_params()
1034 struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; in adau1373_hw_params()
1036 unsigned int freq; in adau1373_hw_params() local
1039 freq = adau1373_dai->sysclk; in adau1373_hw_params()
1041 if (freq % params_rate(params) != 0) in adau1373_hw_params()
1042 return -EINVAL; in adau1373_hw_params()
1044 switch (freq / params_rate(params)) { in adau1373_hw_params()
1067 return -EINVAL; in adau1373_hw_params()
1070 adau1373_dai->enable_src = (div != 0); in adau1373_hw_params()
1072 regmap_update_bits(adau1373->regmap, ADAU1373_BCLKDIV(dai->id), in adau1373_hw_params()
1090 return -EINVAL; in adau1373_hw_params()
1093 return regmap_update_bits(adau1373->regmap, ADAU1373_DAI(dai->id), in adau1373_hw_params()
1099 struct snd_soc_component *component = dai->component; in adau1373_set_dai_fmt()
1101 struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; in adau1373_set_dai_fmt()
1107 adau1373_dai->clock_provider = true; in adau1373_set_dai_fmt()
1111 adau1373_dai->clock_provider = false; in adau1373_set_dai_fmt()
1114 return -EINVAL; in adau1373_set_dai_fmt()
1131 return -EINVAL; in adau1373_set_dai_fmt()
1147 return -EINVAL; in adau1373_set_dai_fmt()
1150 regmap_update_bits(adau1373->regmap, ADAU1373_DAI(dai->id), in adau1373_set_dai_fmt()
1157 int clk_id, unsigned int freq, int dir) in adau1373_set_dai_sysclk() argument
1159 struct adau1373 *adau1373 = snd_soc_component_get_drvdata(dai->component); in adau1373_set_dai_sysclk()
1160 struct adau1373_dai *adau1373_dai = &adau1373->dais[dai->id]; in adau1373_set_dai_sysclk()
1167 return -EINVAL; in adau1373_set_dai_sysclk()
1170 adau1373_dai->sysclk = freq; in adau1373_set_dai_sysclk()
1171 adau1373_dai->clk_src = clk_id; in adau1373_set_dai_sysclk()
1173 regmap_update_bits(adau1373->regmap, ADAU1373_BCLKDIV(dai->id), in adau1373_set_dai_sysclk()
1191 .name = "adau1373-aif1",
1211 .name = "adau1373-aif2",
1231 .name = "adau1373-aif3",
1264 return -EINVAL; in adau1373_set_pll()
1282 return -EINVAL; in adau1373_set_pll()
1286 return -EINVAL; in adau1373_set_pll()
1289 return -EINVAL; in adau1373_set_pll()
1300 return -EINVAL; in adau1373_set_pll()
1303 dpll_div = 11 - dpll_div; in adau1373_set_pll()
1304 regmap_update_bits(adau1373->regmap, ADAU1373_PLL_CTRL6(pll_id), in adau1373_set_pll()
1307 regmap_update_bits(adau1373->regmap, ADAU1373_PLL_CTRL6(pll_id), in adau1373_set_pll()
1312 regmap_write(adau1373->regmap, ADAU1373_DPLL_CTRL(pll_id), in adau1373_set_pll()
1314 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL1(pll_id), pll_regs[0]); in adau1373_set_pll()
1315 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL2(pll_id), pll_regs[1]); in adau1373_set_pll()
1316 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL3(pll_id), pll_regs[2]); in adau1373_set_pll()
1317 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL4(pll_id), pll_regs[3]); in adau1373_set_pll()
1318 regmap_write(adau1373->regmap, ADAU1373_PLL_CTRL5(pll_id), pll_regs[4]); in adau1373_set_pll()
1321 regmap_update_bits(adau1373->regmap, ADAU1373_CLK_SRC_DIV(pll_id), 0x3f, 0x09); in adau1373_set_pll()
1332 regmap_write(adau1373->regmap, ADAU1373_DRC(nr) + i, drc[i]); in adau1373_load_drc_settings()
1352 struct adau1373_platform_data *pdata = component->dev->platform_data; in adau1373_probe()
1358 if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting)) in adau1373_probe()
1359 return -EINVAL; in adau1373_probe()
1361 if (!adau1373_valid_micbias(pdata->micbias1) || in adau1373_probe()
1362 !adau1373_valid_micbias(pdata->micbias2)) in adau1373_probe()
1363 return -EINVAL; in adau1373_probe()
1365 for (i = 0; i < pdata->num_drc; ++i) { in adau1373_probe()
1367 pdata->drc_setting[i]); in adau1373_probe()
1371 pdata->num_drc); in adau1373_probe()
1375 if (pdata->input_differential[i]) in adau1373_probe()
1378 regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val); in adau1373_probe()
1381 if (pdata->lineout_differential) in adau1373_probe()
1383 if (pdata->lineout_ground_sense) in adau1373_probe()
1385 regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val); in adau1373_probe()
1387 lineout_differential = pdata->lineout_differential; in adau1373_probe()
1389 regmap_write(adau1373->regmap, ADAU1373_EP_CTRL, in adau1373_probe()
1390 (pdata->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) | in adau1373_probe()
1391 (pdata->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET)); in adau1373_probe()
1399 regmap_write(adau1373->regmap, ADAU1373_ADC_CTRL, in adau1373_probe()
1416 regmap_update_bits(adau1373->regmap, ADAU1373_PWDN_CTRL3, in adau1373_set_bias_level()
1420 regmap_update_bits(adau1373->regmap, ADAU1373_PWDN_CTRL3, in adau1373_set_bias_level()
1431 regcache_sync(adau1373->regmap); in adau1373_resume()
1479 adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL); in adau1373_i2c_probe()
1481 return -ENOMEM; in adau1373_i2c_probe()
1483 adau1373->regmap = devm_regmap_init_i2c(client, in adau1373_i2c_probe()
1485 if (IS_ERR(adau1373->regmap)) in adau1373_i2c_probe()
1486 return PTR_ERR(adau1373->regmap); in adau1373_i2c_probe()
1488 regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00); in adau1373_i2c_probe()
1490 dev_set_drvdata(&client->dev, adau1373); in adau1373_i2c_probe()
1492 ret = devm_snd_soc_register_component(&client->dev, in adau1373_i2c_probe()
1515 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");