Lines Matching +full:vl +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * The data format accepted is I2S or left-justified.
130 * Default CS4271 power-up configuration
131 * Array contains non-existing in hw register at address 0
151 "vd", "vl", "va"
159 /* Current sample rate for de-emphasis control */
173 SND_SOC_DAPM_OUTPUT("AOUTA-"),
175 SND_SOC_DAPM_OUTPUT("AOUTB-"),
183 { "AOUTA-", NULL, "Playback" },
185 { "AOUTB-", NULL, "Playback" },
196 struct snd_soc_component *component = codec_dai->component; in cs4271_set_dai_sysclk()
199 cs4271->mclk = freq; in cs4271_set_dai_sysclk()
206 struct snd_soc_component *component = codec_dai->component; in cs4271_set_dai_fmt()
213 cs4271->master = false; in cs4271_set_dai_fmt()
216 cs4271->master = true; in cs4271_set_dai_fmt()
220 dev_err(component->dev, "Invalid DAI format\n"); in cs4271_set_dai_fmt()
221 return -EINVAL; in cs4271_set_dai_fmt()
227 ret = regmap_update_bits(cs4271->regmap, CS4271_ADCCTL, in cs4271_set_dai_fmt()
234 ret = regmap_update_bits(cs4271->regmap, CS4271_ADCCTL, in cs4271_set_dai_fmt()
240 dev_err(component->dev, "Invalid DAI format\n"); in cs4271_set_dai_fmt()
241 return -EINVAL; in cs4271_set_dai_fmt()
244 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE1, in cs4271_set_dai_fmt()
259 if (cs4271->deemph) { in cs4271_set_deemph()
260 /* Find closest de-emphasis freq */ in cs4271_set_deemph()
263 if (abs(cs4271_deemph[i] - cs4271->rate) < in cs4271_set_deemph()
264 abs(cs4271_deemph[val] - cs4271->rate)) in cs4271_set_deemph()
269 ret = regmap_update_bits(cs4271->regmap, CS4271_DACCTL, in cs4271_set_deemph()
282 ucontrol->value.integer.value[0] = cs4271->deemph; in cs4271_get_deemph()
292 cs4271->deemph = ucontrol->value.integer.value[0]; in cs4271_put_deemph()
339 struct snd_soc_component *component = dai->component; in cs4271_hw_params()
344 if (cs4271->enable_soft_reset) { in cs4271_hw_params()
354 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in cs4271_hw_params()
356 (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in cs4271_hw_params()
358 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_hw_params()
364 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_hw_params()
371 cs4271->rate = params_rate(params); in cs4271_hw_params()
374 if (cs4271->rate < 50000) in cs4271_hw_params()
376 else if (cs4271->rate < 100000) in cs4271_hw_params()
381 ratio = cs4271->mclk / cs4271->rate; in cs4271_hw_params()
383 if ((cs4271_clk_tab[i].master == cs4271->master) && in cs4271_hw_params()
389 dev_err(component->dev, "Invalid sample rate\n"); in cs4271_hw_params()
390 return -EINVAL; in cs4271_hw_params()
395 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE1, in cs4271_hw_params()
405 struct snd_soc_component *component = dai->component; in cs4271_mute_stream()
419 ret = regmap_update_bits(cs4271->regmap, CS4271_VOLA, in cs4271_mute_stream()
424 ret = regmap_update_bits(cs4271->regmap, CS4271_VOLB, in cs4271_mute_stream()
433 static DECLARE_TLV_DB_SCALE(cs4271_dac_tlv, -12700, 100, 0);
441 SOC_SINGLE_BOOL_EXT("De-emphasis Switch", 0,
443 SOC_SINGLE("Auto-Mute Switch", CS4271_DACCTL, 7, 1, 0),
445 SOC_SINGLE("Soft Volume Ramp-Up Switch", CS4271_DACCTL, 3, 1, 0),
446 SOC_SINGLE("Soft Ramp-Down Switch", CS4271_DACCTL, 2, 1, 0),
450 SOC_SINGLE("Dither 16-Bit Data Switch", CS4271_ADCCTL, 5, 1, 0),
464 .name = "cs4271-hifi",
487 gpiod_direction_output(cs4271->reset, 1); in cs4271_reset()
489 gpiod_set_value(cs4271->reset, 0); in cs4271_reset()
501 /* Set power-down bit */ in cs4271_soc_suspend()
502 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_soc_suspend()
507 regcache_mark_dirty(cs4271->regmap); in cs4271_soc_suspend()
508 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); in cs4271_soc_suspend()
518 ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), in cs4271_soc_resume()
519 cs4271->supplies); in cs4271_soc_resume()
521 dev_err(component->dev, "Failed to enable regulators: %d\n", ret); in cs4271_soc_resume()
529 ret = regcache_sync(cs4271->regmap); in cs4271_soc_resume()
533 /* then disable the power-down bit */ in cs4271_soc_resume()
534 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_soc_resume()
558 struct cs4271_platform_data *cs4271plat = component->dev->platform_data; in cs4271_component_probe()
562 amutec_eq_bmutec = of_property_read_bool(component->dev->of_node, in cs4271_component_probe()
563 "cirrus,amutec-eq-bmutec"); in cs4271_component_probe()
564 cs4271->enable_soft_reset = of_property_read_bool(component->dev->of_node, in cs4271_component_probe()
565 "cirrus,enable-soft-reset"); in cs4271_component_probe()
567 ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), in cs4271_component_probe()
568 cs4271->supplies); in cs4271_component_probe()
570 dev_err(component->dev, "Failed to enable regulators: %d\n", ret); in cs4271_component_probe()
575 amutec_eq_bmutec = cs4271plat->amutec_eq_bmutec; in cs4271_component_probe()
576 cs4271->enable_soft_reset = cs4271plat->enable_soft_reset; in cs4271_component_probe()
582 ret = regcache_sync(cs4271->regmap); in cs4271_component_probe()
586 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_component_probe()
591 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_component_probe()
595 /* Power-up sequence requires 85 uS */ in cs4271_component_probe()
599 regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_component_probe()
611 gpiod_set_value(cs4271->reset, 1); in cs4271_component_remove()
613 regcache_mark_dirty(cs4271->regmap); in cs4271_component_remove()
614 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); in cs4271_component_remove()
641 return -ENOMEM; in cs4271_common_probe()
643 cs4271->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); in cs4271_common_probe()
644 if (IS_ERR(cs4271->reset)) in cs4271_common_probe()
645 return dev_err_probe(dev, PTR_ERR(cs4271->reset), in cs4271_common_probe()
647 gpiod_set_consumer_name(cs4271->reset, "CS4271 Reset"); in cs4271_common_probe()
650 cs4271->supplies[i].supply = supply_names[i]; in cs4271_common_probe()
652 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(cs4271->supplies), in cs4271_common_probe()
653 cs4271->supplies); in cs4271_common_probe()
688 cs4271->regmap = regmap; in cs4271_probe()