Lines Matching full:cs42l51
3 * cs42l51.c
5 * ASoC Driver for Cirrus Logic CS42L51 codecs
29 #include "cs42l51.h"
258 struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp); in mclk_event() local
262 return clk_prepare_enable(cs42l51->mclk_handle); in mclk_event()
266 clk_disable_unprepare(cs42l51->mclk_handle); in mclk_event()
311 struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); in cs42l51_set_dai_fmt() local
317 cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK; in cs42l51_set_dai_fmt()
326 cs42l51->func = MODE_MASTER; in cs42l51_set_dai_fmt()
329 cs42l51->func = MODE_SLAVE_AUTO; in cs42l51_set_dai_fmt()
387 struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); in cs42l51_set_dai_sysclk() local
389 cs42l51->mclk = freq; in cs42l51_set_dai_sysclk()
398 struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); in cs42l51_hw_params() local
407 switch (cs42l51->func) { in cs42l51_hw_params()
424 ratio = cs42l51->mclk / rate; /* MCLK/LRCK ratio */ in cs42l51_hw_params()
444 switch (cs42l51->func) { in cs42l51_hw_params()
466 switch (cs42l51->audio_mode) { in cs42l51_hw_params()
545 .name = "cs42l51-hifi",
567 struct cs42l51_private *cs42l51; in cs42l51_component_probe() local
569 cs42l51 = snd_soc_component_get_drvdata(component); in cs42l51_component_probe()
572 if (cs42l51->mclk_handle) in cs42l51_component_probe()
712 struct cs42l51_private *cs42l51; in cs42l51_probe() local
719 cs42l51 = devm_kzalloc(dev, sizeof(struct cs42l51_private), in cs42l51_probe()
721 if (!cs42l51) in cs42l51_probe()
724 dev_set_drvdata(dev, cs42l51); in cs42l51_probe()
725 cs42l51->regmap = regmap; in cs42l51_probe()
727 cs42l51->mclk_handle = devm_clk_get_optional(dev, "MCLK"); in cs42l51_probe()
728 if (IS_ERR(cs42l51->mclk_handle)) in cs42l51_probe()
729 return PTR_ERR(cs42l51->mclk_handle); in cs42l51_probe()
731 for (i = 0; i < ARRAY_SIZE(cs42l51->supplies); i++) in cs42l51_probe()
732 cs42l51->supplies[i].supply = cs42l51_supply_names[i]; in cs42l51_probe()
734 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(cs42l51->supplies), in cs42l51_probe()
735 cs42l51->supplies); in cs42l51_probe()
741 ret = regulator_bulk_enable(ARRAY_SIZE(cs42l51->supplies), in cs42l51_probe()
742 cs42l51->supplies); in cs42l51_probe()
748 cs42l51->reset_gpio = devm_gpiod_get_optional(dev, "reset", in cs42l51_probe()
750 if (IS_ERR(cs42l51->reset_gpio)) { in cs42l51_probe()
751 ret = PTR_ERR(cs42l51->reset_gpio); in cs42l51_probe()
755 if (cs42l51->reset_gpio) { in cs42l51_probe()
757 gpiod_set_value_cansleep(cs42l51->reset_gpio, 0); in cs42l51_probe()
761 /* Verify that we have a CS42L51 */ in cs42l51_probe()
774 dev_info(dev, "Cirrus Logic CS42L51, Revision: %02X\n", in cs42l51_probe()
785 gpiod_set_value_cansleep(cs42l51->reset_gpio, 1); in cs42l51_probe()
786 regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies), in cs42l51_probe()
787 cs42l51->supplies); in cs42l51_probe()
794 struct cs42l51_private *cs42l51 = dev_get_drvdata(dev); in cs42l51_remove() local
797 gpiod_set_value_cansleep(cs42l51->reset_gpio, 1); in cs42l51_remove()
799 ret = regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies), in cs42l51_remove()
800 cs42l51->supplies); in cs42l51_remove()
810 struct cs42l51_private *cs42l51 = dev_get_drvdata(dev); in cs42l51_suspend() local
812 regcache_cache_only(cs42l51->regmap, true); in cs42l51_suspend()
813 regcache_mark_dirty(cs42l51->regmap); in cs42l51_suspend()
821 struct cs42l51_private *cs42l51 = dev_get_drvdata(dev); in cs42l51_resume() local
823 regcache_cache_only(cs42l51->regmap, false); in cs42l51_resume()
825 return regcache_sync(cs42l51->regmap); in cs42l51_resume()
830 MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver");