Lines Matching +full:pll +full:- +full:master

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Author: Lars-Peter Clausen <lars@metafoo.de>
46 #define ADAV80X_PLL_CLK_SRC_PLL_XIN(pll) 0x00 argument
47 #define ADAV80X_PLL_CLK_SRC_PLL_MCLKI(pll) (0x40 << (pll)) argument
48 #define ADAV80X_PLL_CLK_SRC_PLL_MASK(pll) (0x40 << (pll)) argument
56 #define ADAV80X_PLL_CTRL1_PLLPD(pll) (0x04 << (pll)) argument
59 #define ADAV80X_PLL_CTRL2_FIELD(pll, x) ((x) << ((pll) * 4)) argument
61 #define ADAV80X_PLL_CTRL2_FS_48(pll) ADAV80X_PLL_CTRL2_FIELD((pll), 0x00) argument
62 #define ADAV80X_PLL_CTRL2_FS_32(pll) ADAV80X_PLL_CTRL2_FIELD((pll), 0x08) argument
63 #define ADAV80X_PLL_CTRL2_FS_44(pll) ADAV80X_PLL_CTRL2_FIELD((pll), 0x0c) argument
65 #define ADAV80X_PLL_CTRL2_SEL(pll) ADAV80X_PLL_CTRL2_FIELD((pll), 0x02) argument
66 #define ADAV80X_PLL_CTRL2_DOUB(pll) ADAV80X_PLL_CTRL2_FIELD((pll), 0x01) argument
67 #define ADAV80X_PLL_CTRL2_PLL_MASK(pll) ADAV80X_PLL_CTRL2_FIELD((pll), 0x0f) argument
113 #define ADAV80X_PLL_OUTE_SYSCLKPD(x) BIT(2 - (x))
214 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in adav80x_dapm_sysclk_check()
218 switch (adav80x->clk_src) { in adav80x_dapm_sysclk_check()
238 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in adav80x_dapm_pll_check()
241 return adav80x->pll_src == ADAV80X_PLL_SRC_XTAL; in adav80x_dapm_pll_check()
288 if (adav80x->deemph) { in adav80x_set_deemph()
289 switch (adav80x->rate) { in adav80x_set_deemph()
310 return regmap_update_bits(adav80x->regmap, ADAV80X_DAC_CTRL2, in adav80x_set_deemph()
319 unsigned int deemph = ucontrol->value.integer.value[0]; in adav80x_put_deemph()
322 return -EINVAL; in adav80x_put_deemph()
324 adav80x->deemph = deemph; in adav80x_put_deemph()
335 ucontrol->value.integer.value[0] = adav80x->deemph; in adav80x_get_deemph()
340 static const DECLARE_TLV_DB_MINMAX(adav80x_digital_tlv, -9563, 0);
343 SOC_DOUBLE_R_TLV("Master Playback Volume", ADAV80X_DAC_L_VOL,
345 SOC_DOUBLE_R_TLV("Master Capture Volume", ADAV80X_ADC_L_VOL,
351 SOC_DOUBLE("Master Playback Switch", ADAV80X_DAC_CTRL1, 0, 1, 1, 0),
352 SOC_DOUBLE("Master Capture Switch", ADAV80X_ADC_CTRL1, 2, 3, 1, 1),
356 SOC_SINGLE_BOOL_EXT("Playback De-emphasis Switch", 0,
367 struct snd_soc_component *component = dai->component; in adav80x_set_dai_fmt()
380 return -EINVAL; in adav80x_set_dai_fmt()
397 return -EINVAL; in adav80x_set_dai_fmt()
404 return -EINVAL; in adav80x_set_dai_fmt()
407 regmap_update_bits(adav80x->regmap, adav80x_port_ctrl_regs[dai->id][0], in adav80x_set_dai_fmt()
410 regmap_write(adav80x->regmap, adav80x_port_ctrl_regs[dai->id][1], in adav80x_set_dai_fmt()
413 adav80x->dai_fmt[dai->id] = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in adav80x_set_dai_fmt()
429 regmap_update_bits(adav80x->regmap, ADAV80X_ADC_CTRL1, in adav80x_set_adc_clock()
446 regmap_update_bits(adav80x->regmap, ADAV80X_DAC_CTRL2, in adav80x_set_dac_clock()
473 return -EINVAL; in adav80x_set_capture_pcm_format()
476 regmap_update_bits(adav80x->regmap, adav80x_port_ctrl_regs[dai->id][0], in adav80x_set_capture_pcm_format()
488 if (adav80x->dai_fmt[dai->id] != SND_SOC_DAIFMT_RIGHT_J) in adav80x_set_playback_pcm_format()
505 return -EINVAL; in adav80x_set_playback_pcm_format()
508 regmap_update_bits(adav80x->regmap, adav80x_port_ctrl_regs[dai->id][1], in adav80x_set_playback_pcm_format()
517 struct snd_soc_component *component = dai->component; in adav80x_hw_params()
521 if (rate * 256 != adav80x->sysclk) in adav80x_hw_params()
522 return -EINVAL; in adav80x_hw_params()
524 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in adav80x_hw_params()
531 adav80x->rate = rate; in adav80x_hw_params()
553 return -EINVAL; in adav80x_set_sysclk()
556 adav80x->sysclk = freq; in adav80x_set_sysclk()
558 if (adav80x->clk_src != clk_id) { in adav80x_set_sysclk()
561 adav80x->clk_src = clk_id; in adav80x_set_sysclk()
570 regmap_write(adav80x->regmap, ADAV80X_ICLK_CTRL1, in adav80x_set_sysclk()
572 regmap_write(adav80x->regmap, ADAV80X_ICLK_CTRL2, in adav80x_set_sysclk()
586 return -EINVAL; in adav80x_set_sysclk()
589 clk_id -= ADAV80X_CLK_SYSCLK1; in adav80x_set_sysclk()
593 regmap_update_bits(adav80x->regmap, ADAV80X_PLL_OUTE, in adav80x_set_sysclk()
595 adav80x->sysclk_pd[clk_id] = true; in adav80x_set_sysclk()
597 regmap_update_bits(adav80x->regmap, ADAV80X_PLL_OUTE, in adav80x_set_sysclk()
599 adav80x->sysclk_pd[clk_id] = false; in adav80x_set_sysclk()
604 if (adav80x->sysclk_pd[0]) in adav80x_set_sysclk()
609 if (adav80x->sysclk_pd[1] || adav80x->sysclk_pd[2]) in adav80x_set_sysclk()
637 return -EINVAL; in adav80x_set_pll()
653 return -EINVAL; in adav80x_set_pll()
673 return -EINVAL; in adav80x_set_pll()
676 regmap_update_bits(adav80x->regmap, ADAV80X_PLL_CTRL1, in adav80x_set_pll()
678 regmap_update_bits(adav80x->regmap, ADAV80X_PLL_CTRL2, in adav80x_set_pll()
681 if (source != adav80x->pll_src) { in adav80x_set_pll()
687 regmap_update_bits(adav80x->regmap, ADAV80X_PLL_CLK_SRC, in adav80x_set_pll()
690 adav80x->pll_src = source; in adav80x_set_pll()
710 regmap_update_bits(adav80x->regmap, ADAV80X_DAC_CTRL1, mask, in adav80x_set_bias_level()
714 regmap_update_bits(adav80x->regmap, ADAV80X_DAC_CTRL1, mask, in adav80x_set_bias_level()
726 struct snd_soc_component *component = dai->component; in adav80x_dai_startup()
729 if (!snd_soc_component_active(component) || !adav80x->rate) in adav80x_dai_startup()
732 return snd_pcm_hw_constraint_single(substream->runtime, in adav80x_dai_startup()
733 SNDRV_PCM_HW_PARAM_RATE, adav80x->rate); in adav80x_dai_startup()
739 struct snd_soc_component *component = dai->component; in adav80x_dai_shutdown()
743 adav80x->rate = 0; in adav80x_dai_shutdown()
764 .name = "adav80x-hifi",
783 .name = "adav80x-aux",
813 regmap_write(adav80x->regmap, ADAV80X_PLL_OUTE, 0x20); in adav80x_probe()
815 regmap_write(adav80x->regmap, ADAV80X_DAC_CTRL3, 0x6); in adav80x_probe()
824 regcache_sync(adav80x->regmap); in adav80x_resume()
856 return -ENOMEM; in adav80x_bus_probe()
859 adav80x->regmap = regmap; in adav80x_bus_probe()
880 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");