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.
132 * Default CS4271 power-up configuration
133 * Array contains non-existing in hw register at address 0
153 "vd", "vl", "va"
161 /* Current sample rate for de-emphasis control */
177 SND_SOC_DAPM_OUTPUT("AOUTA-"),
179 SND_SOC_DAPM_OUTPUT("AOUTB-"),
187 { "AOUTA-", NULL, "Playback" },
189 { "AOUTB-", NULL, "Playback" },
200 struct snd_soc_component *component = codec_dai->component; in cs4271_set_dai_sysclk()
203 cs4271->mclk = freq; in cs4271_set_dai_sysclk()
210 struct snd_soc_component *component = codec_dai->component; in cs4271_set_dai_fmt()
217 cs4271->master = false; in cs4271_set_dai_fmt()
220 cs4271->master = true; in cs4271_set_dai_fmt()
224 dev_err(component->dev, "Invalid DAI format\n"); in cs4271_set_dai_fmt()
225 return -EINVAL; in cs4271_set_dai_fmt()
231 ret = regmap_update_bits(cs4271->regmap, CS4271_ADCCTL, in cs4271_set_dai_fmt()
238 ret = regmap_update_bits(cs4271->regmap, CS4271_ADCCTL, in cs4271_set_dai_fmt()
244 dev_err(component->dev, "Invalid DAI format\n"); in cs4271_set_dai_fmt()
245 return -EINVAL; in cs4271_set_dai_fmt()
248 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE1, in cs4271_set_dai_fmt()
263 if (cs4271->deemph) { in cs4271_set_deemph()
264 /* Find closest de-emphasis freq */ in cs4271_set_deemph()
267 if (abs(cs4271_deemph[i] - cs4271->rate) < in cs4271_set_deemph()
268 abs(cs4271_deemph[val] - cs4271->rate)) in cs4271_set_deemph()
273 ret = regmap_update_bits(cs4271->regmap, CS4271_DACCTL, in cs4271_set_deemph()
286 ucontrol->value.integer.value[0] = cs4271->deemph; in cs4271_get_deemph()
296 cs4271->deemph = ucontrol->value.integer.value[0]; in cs4271_put_deemph()
343 struct snd_soc_component *component = dai->component; in cs4271_hw_params()
348 if (cs4271->enable_soft_reset) { in cs4271_hw_params()
358 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK && in cs4271_hw_params()
360 (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in cs4271_hw_params()
362 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_hw_params()
368 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_hw_params()
375 cs4271->rate = params_rate(params); in cs4271_hw_params()
378 if (cs4271->rate < 50000) in cs4271_hw_params()
380 else if (cs4271->rate < 100000) in cs4271_hw_params()
385 ratio = cs4271->mclk / cs4271->rate; in cs4271_hw_params()
387 if ((cs4271_clk_tab[i].master == cs4271->master) && in cs4271_hw_params()
393 dev_err(component->dev, "Invalid sample rate\n"); in cs4271_hw_params()
394 return -EINVAL; in cs4271_hw_params()
399 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE1, in cs4271_hw_params()
409 struct snd_soc_component *component = dai->component; in cs4271_mute_stream()
423 ret = regmap_update_bits(cs4271->regmap, CS4271_VOLA, in cs4271_mute_stream()
428 ret = regmap_update_bits(cs4271->regmap, CS4271_VOLB, in cs4271_mute_stream()
437 static DECLARE_TLV_DB_SCALE(cs4271_dac_tlv, -12700, 100, 0);
445 SOC_SINGLE_BOOL_EXT("De-emphasis Switch", 0,
447 SOC_SINGLE("Auto-Mute Switch", CS4271_DACCTL, 7, 1, 0),
449 SOC_SINGLE("Soft Volume Ramp-Up Switch", CS4271_DACCTL, 3, 1, 0),
450 SOC_SINGLE("Soft Ramp-Down Switch", CS4271_DACCTL, 2, 1, 0),
454 SOC_SINGLE("Dither 16-Bit Data Switch", CS4271_ADCCTL, 5, 1, 0),
468 .name = "cs4271-hifi",
491 if (gpio_is_valid(cs4271->gpio_nreset)) { in cs4271_reset()
492 gpio_direction_output(cs4271->gpio_nreset, 0); in cs4271_reset()
494 gpio_set_value(cs4271->gpio_nreset, 1); in cs4271_reset()
507 /* Set power-down bit */ in cs4271_soc_suspend()
508 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_soc_suspend()
513 regcache_mark_dirty(cs4271->regmap); in cs4271_soc_suspend()
514 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); in cs4271_soc_suspend()
524 ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), in cs4271_soc_resume()
525 cs4271->supplies); in cs4271_soc_resume()
527 dev_err(component->dev, "Failed to enable regulators: %d\n", ret); in cs4271_soc_resume()
535 ret = regcache_sync(cs4271->regmap); in cs4271_soc_resume()
539 /* then disable the power-down bit */ in cs4271_soc_resume()
540 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_soc_resume()
564 struct cs4271_platform_data *cs4271plat = component->dev->platform_data; in cs4271_component_probe()
569 if (of_match_device(cs4271_dt_ids, component->dev)) { in cs4271_component_probe()
570 if (of_get_property(component->dev->of_node, in cs4271_component_probe()
571 "cirrus,amutec-eq-bmutec", NULL)) in cs4271_component_probe()
574 if (of_get_property(component->dev->of_node, in cs4271_component_probe()
575 "cirrus,enable-soft-reset", NULL)) in cs4271_component_probe()
576 cs4271->enable_soft_reset = true; in cs4271_component_probe()
580 ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), in cs4271_component_probe()
581 cs4271->supplies); in cs4271_component_probe()
583 dev_err(component->dev, "Failed to enable regulators: %d\n", ret); in cs4271_component_probe()
588 amutec_eq_bmutec = cs4271plat->amutec_eq_bmutec; in cs4271_component_probe()
589 cs4271->enable_soft_reset = cs4271plat->enable_soft_reset; in cs4271_component_probe()
595 ret = regcache_sync(cs4271->regmap); in cs4271_component_probe()
599 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_component_probe()
604 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_component_probe()
608 /* Power-up sequence requires 85 uS */ in cs4271_component_probe()
612 regmap_update_bits(cs4271->regmap, CS4271_MODE2, in cs4271_component_probe()
623 if (gpio_is_valid(cs4271->gpio_nreset)) in cs4271_component_remove()
625 gpio_set_value(cs4271->gpio_nreset, 0); in cs4271_component_remove()
627 regcache_mark_dirty(cs4271->regmap); in cs4271_component_remove()
628 regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); in cs4271_component_remove()
650 struct cs4271_platform_data *cs4271plat = dev->platform_data; in cs4271_common_probe()
656 return -ENOMEM; in cs4271_common_probe()
659 cs4271->gpio_nreset = in cs4271_common_probe()
660 of_get_named_gpio(dev->of_node, "reset-gpio", 0); in cs4271_common_probe()
663 cs4271->gpio_nreset = cs4271plat->gpio_nreset; in cs4271_common_probe()
665 if (gpio_is_valid(cs4271->gpio_nreset)) { in cs4271_common_probe()
666 ret = devm_gpio_request(dev, cs4271->gpio_nreset, in cs4271_common_probe()
673 cs4271->supplies[i].supply = supply_names[i]; in cs4271_common_probe()
675 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(cs4271->supplies), in cs4271_common_probe()
676 cs4271->supplies); in cs4271_common_probe()
711 cs4271->regmap = regmap; in cs4271_probe()