Lines Matching +full:vd +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
9 * Based on cs4270.c - Copyright (c) Freescale Semiconductor
12 * - Only I2C is support. Not SPI
13 * - master mode *NOT* supported
39 "VD",
47 unsigned int audio_mode; /* The mode (I2S or left-justified) */
69 ucontrol->value.enumerated.item[0] = 0; in cs42l51_get_chan_mix()
74 ucontrol->value.enumerated.item[0] = 1; in cs42l51_get_chan_mix()
77 ucontrol->value.enumerated.item[0] = 2; in cs42l51_get_chan_mix()
94 switch (ucontrol->value.enumerated.item[0]) { in cs42l51_set_chan_mix()
112 static const DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -5150, 50, 0);
113 static const DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0);
115 static const DECLARE_TLV_DB_SCALE(aout_tlv, -10200, 50, 0);
125 static const DECLARE_TLV_DB_SCALE(pga_tlv, -300, 50, 0);
126 static const DECLARE_TLV_DB_SCALE(adc_att_tlv, -9600, 100, 0);
151 SOC_SINGLE("Auto-Mute Switch", CS42L51_DAC_CTL, 2, 1, 0),
168 * 2.) enable power-down for the select channels
174 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in cs42l51_pdn_event()
251 SND_SOC_DAPM_MUX("PGA-ADC Mux Left", SND_SOC_NOPM, 0, 0,
253 SND_SOC_DAPM_MUX("PGA-ADC Mux Right", SND_SOC_NOPM, 0, 0,
260 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in mclk_event()
265 return clk_prepare_enable(cs42l51->mclk_handle); in mclk_event()
267 /* Delay mclk shutdown to fulfill power-down sequence requirements */ in mclk_event()
269 clk_disable_unprepare(cs42l51->mclk_handle); in mclk_event()
297 {"PGA-ADC Mux Left", "AIN1 Left", "AIN1L" },
298 {"PGA-ADC Mux Left", "AIN2 Left", "AIN2L" },
299 {"PGA-ADC Mux Left", "MIC Left", "MICL" },
300 {"PGA-ADC Mux Left", "MIC+preamp Left", "Mic Preamp Left" },
301 {"PGA-ADC Mux Right", "AIN1 Right", "AIN1R" },
302 {"PGA-ADC Mux Right", "AIN2 Right", "AIN2R" },
303 {"PGA-ADC Mux Right", "MIC Right", "MICR" },
304 {"PGA-ADC Mux Right", "MIC+preamp Right", "Mic Preamp Right" },
306 {"Left PGA", NULL, "PGA-ADC Mux Left"},
307 {"Right PGA", NULL, "PGA-ADC Mux Right"},
313 struct snd_soc_component *component = codec_dai->component; in cs42l51_set_dai_fmt()
320 cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK; in cs42l51_set_dai_fmt()
323 dev_err(component->dev, "invalid DAI format\n"); in cs42l51_set_dai_fmt()
324 return -EINVAL; in cs42l51_set_dai_fmt()
329 cs42l51->func = MODE_MASTER; in cs42l51_set_dai_fmt()
332 cs42l51->func = MODE_SLAVE_AUTO; in cs42l51_set_dai_fmt()
335 dev_err(component->dev, "Unknown master/slave configuration\n"); in cs42l51_set_dai_fmt()
336 return -EINVAL; in cs42l51_set_dai_fmt()
375 * Recommended configurations are SSM for 4-50khz and DSM for 50-100kHz ranges
389 struct snd_soc_component *component = codec_dai->component; in cs42l51_set_dai_sysclk()
392 cs42l51->mclk = freq; in cs42l51_set_dai_sysclk()
400 struct snd_soc_component *component = dai->component; in cs42l51_hw_params()
410 switch (cs42l51->func) { in cs42l51_hw_params()
427 ratio = cs42l51->mclk / rate; /* MCLK/LRCK ratio */ in cs42l51_hw_params()
435 dev_err(component->dev, "could not find matching ratio\n"); in cs42l51_hw_params()
436 return -EINVAL; in cs42l51_hw_params()
447 switch (cs42l51->func) { in cs42l51_hw_params()
469 switch (cs42l51->audio_mode) { in cs42l51_hw_params()
492 dev_err(component->dev, "unknown format\n"); in cs42l51_hw_params()
493 return -EINVAL; in cs42l51_hw_params()
498 dev_err(component->dev, "unknown format\n"); in cs42l51_hw_params()
499 return -EINVAL; in cs42l51_hw_params()
518 struct snd_soc_component *component = dai->component; in cs42l51_dai_mute()
548 .name = "cs42l51-hifi",
575 if (cs42l51->mclk_handle) in cs42l51_component_probe()
580 * - Use signal processor in cs42l51_component_probe()
581 * - auto mute in cs42l51_component_probe()
582 * - vol changes immediate in cs42l51_component_probe()
583 * - no de-emphasize in cs42l51_component_probe()
726 return -ENOMEM; in cs42l51_probe()
729 cs42l51->regmap = regmap; in cs42l51_probe()
731 cs42l51->mclk_handle = devm_clk_get(dev, "MCLK"); in cs42l51_probe()
732 if (IS_ERR(cs42l51->mclk_handle)) { in cs42l51_probe()
733 if (PTR_ERR(cs42l51->mclk_handle) != -ENOENT) in cs42l51_probe()
734 return PTR_ERR(cs42l51->mclk_handle); in cs42l51_probe()
735 cs42l51->mclk_handle = NULL; in cs42l51_probe()
738 for (i = 0; i < ARRAY_SIZE(cs42l51->supplies); i++) in cs42l51_probe()
739 cs42l51->supplies[i].supply = cs42l51_supply_names[i]; in cs42l51_probe()
741 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(cs42l51->supplies), in cs42l51_probe()
742 cs42l51->supplies); in cs42l51_probe()
748 ret = regulator_bulk_enable(ARRAY_SIZE(cs42l51->supplies), in cs42l51_probe()
749 cs42l51->supplies); in cs42l51_probe()
755 cs42l51->reset_gpio = devm_gpiod_get_optional(dev, "reset", in cs42l51_probe()
757 if (IS_ERR(cs42l51->reset_gpio)) in cs42l51_probe()
758 return PTR_ERR(cs42l51->reset_gpio); in cs42l51_probe()
760 if (cs42l51->reset_gpio) { in cs42l51_probe()
762 gpiod_set_value_cansleep(cs42l51->reset_gpio, 0); in cs42l51_probe()
776 ret = -ENODEV; in cs42l51_probe()
790 regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies), in cs42l51_probe()
791 cs42l51->supplies); in cs42l51_probe()
800 gpiod_set_value_cansleep(cs42l51->reset_gpio, 1); in cs42l51_remove()
802 return regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies), in cs42l51_remove()
803 cs42l51->supplies); in cs42l51_remove()
811 regcache_cache_only(cs42l51->regmap, true); in cs42l51_suspend()
812 regcache_mark_dirty(cs42l51->regmap); in cs42l51_suspend()
822 regcache_cache_only(cs42l51->regmap, false); in cs42l51_resume()
824 return regcache_sync(cs42l51->regmap); in cs42l51_resume()
835 MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");