This is a note to let you know that I've just added the patch titled Revert "ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek" to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-asoc-atmel-remove-system-clock-tree-configuration-for-at91sam9g20ek.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 0586f3b2e1bd332bc455b41bc5e19028c0fa2228 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Date: Thu, 18 Jan 2024 11:14:14 +0100 Subject: Revert "ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek" From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> This reverts commit 608fc58858bfa7552a9824c2f0e4a3ab8dd4efaa which is commit c775cbf62ed4911e4f0f23880f01815753123690 upstream. It is reported to cause problems, so drop it from the 5.10.y tree for now. Link: https://lore.kernel.org/r/845b3053-d47b-4717-9665-79b120da133b@xxxxxxxxxxxxx Reported-by: Mark Brown <broonie@xxxxxxxxxx> Cc: Codrin Ciubotariu <codrin.ciubotariu@xxxxxxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/soc/atmel/sam9g20_wm8731.c | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c @@ -46,6 +46,35 @@ */ #undef ENABLE_MIC_INPUT +static struct clk *mclk; + +static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + static int mclk_on; + int ret = 0; + + switch (level) { + case SND_SOC_BIAS_ON: + case SND_SOC_BIAS_PREPARE: + if (!mclk_on) + ret = clk_enable(mclk); + if (ret == 0) + mclk_on = 1; + break; + + case SND_SOC_BIAS_OFF: + case SND_SOC_BIAS_STANDBY: + if (mclk_on) + clk_disable(mclk); + mclk_on = 0; + break; + } + + return ret; +} + static const struct snd_soc_dapm_widget at91sam9g20ek_dapm_widgets[] = { SND_SOC_DAPM_MIC("Int Mic", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), @@ -106,6 +135,7 @@ static struct snd_soc_card snd_soc_at91s .owner = THIS_MODULE, .dai_link = &at91sam9g20ek_dai, .num_links = 1, + .set_bias_level = at91sam9g20ek_set_bias_level, .dapm_widgets = at91sam9g20ek_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(at91sam9g20ek_dapm_widgets), @@ -118,6 +148,7 @@ static int at91sam9g20ek_audio_probe(str { struct device_node *np = pdev->dev.of_node; struct device_node *codec_np, *cpu_np; + struct clk *pllb; struct snd_soc_card *card = &snd_soc_at91sam9g20ek; int ret; @@ -131,6 +162,31 @@ static int at91sam9g20ek_audio_probe(str return -EINVAL; } + /* + * Codec MCLK is supplied by PCK0 - set it up. + */ + mclk = clk_get(NULL, "pck0"); + if (IS_ERR(mclk)) { + dev_err(&pdev->dev, "Failed to get MCLK\n"); + ret = PTR_ERR(mclk); + goto err; + } + + pllb = clk_get(NULL, "pllb"); + if (IS_ERR(pllb)) { + dev_err(&pdev->dev, "Failed to get PLLB\n"); + ret = PTR_ERR(pllb); + goto err_mclk; + } + ret = clk_set_parent(mclk, pllb); + clk_put(pllb); + if (ret != 0) { + dev_err(&pdev->dev, "Failed to set MCLK parent\n"); + goto err_mclk; + } + + clk_set_rate(mclk, MCLK_RATE); + card->dev = &pdev->dev; /* Parse device node info */ @@ -174,6 +230,9 @@ static int at91sam9g20ek_audio_probe(str return ret; +err_mclk: + clk_put(mclk); + mclk = NULL; err: atmel_ssc_put_audio(0); return ret; @@ -183,6 +242,8 @@ static int at91sam9g20ek_audio_remove(st { struct snd_soc_card *card = platform_get_drvdata(pdev); + clk_disable(mclk); + mclk = NULL; snd_soc_unregister_card(card); atmel_ssc_put_audio(0); Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-5.10/coresight-etm4x-fix-width-of-ccitmin-field.patch queue-5.10/binder-use-epollerr-from-eventpoll.h.patch queue-5.10/f2fs-explicitly-null-terminate-the-xattr-list.patch queue-5.10/debugfs-fix-automount-d_fsdata-usage.patch queue-5.10/parport-parport_serial-add-brainboxes-bar-details.patch queue-5.10/input-atkbd-use-ab83-as-id-when-skipping-the-getid-command.patch queue-5.10/binder-fix-async-space-check-for-0-sized-buffers.patch queue-5.10/virtio-crypto-fix-memory-leak-in-virtio_crypto_alg_skcipher_close_session.patch queue-5.10/parport-parport_serial-add-brainboxes-device-ids-and-geometry.patch queue-5.10/revert-asoc-atmel-remove-system-clock-tree-configuration-for-at91sam9g20ek.patch queue-5.10/dma-mapping-fix-build-error-unused-value.patch queue-5.10/binder-fix-comment-on-binder_alloc_new_buf-return-value.patch queue-5.10/binder-fix-trivial-typo-of-binder_free_buf_locked.patch queue-5.10/acpi-resource-add-another-dmi-match-for-the-tongfang-gmxxgxx.patch queue-5.10/virtio-crypto-fix-memory-leak.patch queue-5.10/binder-fix-use-after-free-in-shinker-s-callback.patch queue-5.10/keys-dns-fix-size-check-of-v1-server-list-header.patch queue-5.10/uio-fix-use-after-free-in-uio_open.patch queue-5.10/pci-add-acs-quirk-for-more-zhaoxin-root-ports.patch queue-5.10/binder-fix-unused-alloc-free_async_space.patch