Lines Matching +full:wm8524 +full:- +full:audio

1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8524.c -- WM8524 ALSA SoC Audio driver
8 * Based on WM8523 ALSA SoC Audio driver written by Mark Brown
62 struct snd_soc_component *component = dai->component; in wm8524_startup()
63 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_startup() local
66 * MCLK supplied to the CODEC - enforce this. in wm8524_startup()
68 if (!wm8524->sysclk) { in wm8524_startup()
69 dev_err(component->dev, in wm8524_startup()
71 return -EINVAL; in wm8524_startup()
74 snd_pcm_hw_constraint_list(substream->runtime, 0, in wm8524_startup()
76 &wm8524->rate_constraint); in wm8524_startup()
78 gpiod_set_value_cansleep(wm8524->mute, 1); in wm8524_startup()
86 struct snd_soc_component *component = dai->component; in wm8524_shutdown()
87 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_shutdown() local
89 gpiod_set_value_cansleep(wm8524->mute, 0); in wm8524_shutdown()
95 struct snd_soc_component *component = codec_dai->component; in wm8524_set_dai_sysclk()
96 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_set_dai_sysclk() local
100 wm8524->sysclk = freq; in wm8524_set_dai_sysclk()
102 wm8524->rate_constraint.count = 0; in wm8524_set_dai_sysclk()
118 dev_dbg(component->dev, "Supported sample rate: %dHz\n", in wm8524_set_dai_sysclk()
120 wm8524->rate_constraint_list[j++] = val; in wm8524_set_dai_sysclk()
121 wm8524->rate_constraint.count++; in wm8524_set_dai_sysclk()
124 dev_dbg(component->dev, "Skipping sample rate: %dHz\n", in wm8524_set_dai_sysclk()
130 if (wm8524->rate_constraint.count == 0) in wm8524_set_dai_sysclk()
131 return -EINVAL; in wm8524_set_dai_sysclk()
143 dev_err(codec_dai->dev, "Invalid DAI format\n"); in wm8524_set_fmt()
144 return -EINVAL; in wm8524_set_fmt()
152 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(dai->component); in wm8524_mute_stream() local
154 if (wm8524->mute) in wm8524_mute_stream()
155 gpiod_set_value_cansleep(wm8524->mute, mute); in wm8524_mute_stream()
175 .name = "wm8524-hifi",
188 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_probe() local
190 wm8524->rate_constraint.list = &wm8524->rate_constraint_list[0]; in wm8524_probe()
191 wm8524->rate_constraint.count = in wm8524_probe()
192 ARRAY_SIZE(wm8524->rate_constraint_list); in wm8524_probe()
209 { .compatible = "wlf,wm8524" },
216 struct wm8524_priv *wm8524; in wm8524_codec_probe() local
219 wm8524 = devm_kzalloc(&pdev->dev, sizeof(struct wm8524_priv), in wm8524_codec_probe()
221 if (wm8524 == NULL) in wm8524_codec_probe()
222 return -ENOMEM; in wm8524_codec_probe()
224 platform_set_drvdata(pdev, wm8524); in wm8524_codec_probe()
226 wm8524->mute = devm_gpiod_get(&pdev->dev, "wlf,mute", GPIOD_OUT_LOW); in wm8524_codec_probe()
227 if (IS_ERR(wm8524->mute)) { in wm8524_codec_probe()
228 ret = PTR_ERR(wm8524->mute); in wm8524_codec_probe()
229 dev_err_probe(&pdev->dev, ret, "Failed to get mute line\n"); in wm8524_codec_probe()
233 ret = devm_snd_soc_register_component(&pdev->dev, in wm8524_codec_probe()
236 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in wm8524_codec_probe()
244 .name = "wm8524-codec",
250 MODULE_DESCRIPTION("ASoC WM8524 driver");
252 MODULE_ALIAS("platform:wm8524-codec");