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
68 if (wm8524->sysclk) in wm8524_startup()
69 snd_pcm_hw_constraint_list(substream->runtime, 0, in wm8524_startup()
71 &wm8524->rate_constraint); in wm8524_startup()
73 gpiod_set_value_cansleep(wm8524->mute, 1); in wm8524_startup()
81 struct snd_soc_component *component = dai->component; in wm8524_shutdown()
82 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_shutdown() local
84 gpiod_set_value_cansleep(wm8524->mute, 0); in wm8524_shutdown()
90 struct snd_soc_component *component = codec_dai->component; in wm8524_set_dai_sysclk()
91 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_set_dai_sysclk() local
95 wm8524->rate_constraint.count = 0; in wm8524_set_dai_sysclk()
96 wm8524->sysclk = freq; in wm8524_set_dai_sysclk()
97 if (!wm8524->sysclk) in wm8524_set_dai_sysclk()
119 dev_dbg(component->dev, "Supported sample rate: %dHz\n", in wm8524_set_dai_sysclk()
121 wm8524->rate_constraint_list[j++] = val; in wm8524_set_dai_sysclk()
122 wm8524->rate_constraint.count++; in wm8524_set_dai_sysclk()
125 dev_dbg(component->dev, "Skipping sample rate: %dHz\n", in wm8524_set_dai_sysclk()
131 if (wm8524->rate_constraint.count == 0) in wm8524_set_dai_sysclk()
132 return -EINVAL; in wm8524_set_dai_sysclk()
144 dev_err(codec_dai->dev, "Invalid DAI format\n"); in wm8524_set_fmt()
145 return -EINVAL; in wm8524_set_fmt()
153 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(dai->component); in wm8524_mute_stream() local
155 if (wm8524->mute) in wm8524_mute_stream()
156 gpiod_set_value_cansleep(wm8524->mute, mute); in wm8524_mute_stream()
165 struct snd_soc_component *component = dai->component; in wm8524_hw_params()
166 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_hw_params() local
170 if (!wm8524->sysclk) in wm8524_hw_params()
174 for (i = 0; i < wm8524->rate_constraint.count; i++) { in wm8524_hw_params()
175 if (wm8524->rate_constraint.list[i] == params_rate(params)) in wm8524_hw_params()
179 if (i == wm8524->rate_constraint.count) { in wm8524_hw_params()
180 dev_err(component->dev, "LRCLK %d unsupported with MCLK %d\n", in wm8524_hw_params()
181 params_rate(params), wm8524->sysclk); in wm8524_hw_params()
182 return -EINVAL; in wm8524_hw_params()
204 .name = "wm8524-hifi",
217 struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); in wm8524_probe() local
219 wm8524->rate_constraint.list = &wm8524->rate_constraint_list[0]; in wm8524_probe()
220 wm8524->rate_constraint.count = in wm8524_probe()
221 ARRAY_SIZE(wm8524->rate_constraint_list); in wm8524_probe()
238 { .compatible = "wlf,wm8524" },
245 struct wm8524_priv *wm8524; in wm8524_codec_probe() local
248 wm8524 = devm_kzalloc(&pdev->dev, sizeof(struct wm8524_priv), in wm8524_codec_probe()
250 if (wm8524 == NULL) in wm8524_codec_probe()
251 return -ENOMEM; in wm8524_codec_probe()
253 platform_set_drvdata(pdev, wm8524); in wm8524_codec_probe()
255 wm8524->mute = devm_gpiod_get(&pdev->dev, "wlf,mute", GPIOD_OUT_LOW); in wm8524_codec_probe()
256 if (IS_ERR(wm8524->mute)) { in wm8524_codec_probe()
257 ret = PTR_ERR(wm8524->mute); in wm8524_codec_probe()
258 dev_err_probe(&pdev->dev, ret, "Failed to get mute line\n"); in wm8524_codec_probe()
262 ret = devm_snd_soc_register_component(&pdev->dev, in wm8524_codec_probe()
265 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in wm8524_codec_probe()
273 .name = "wm8524-codec",
279 MODULE_DESCRIPTION("ASoC WM8524 driver");
281 MODULE_ALIAS("platform:wm8524-codec");