* [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
@ 2022-08-01 12:26 Shengjiu Wang
2022-08-01 17:47 ` Nicolin Chen
2022-08-15 16:22 ` Mark Brown
0 siblings, 2 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-08-01 12:26 UTC (permalink / raw)
To: nicoleotsuka, Xiubo.Lee, festevam, shengjiu.wang, lgirdwood,
broonie, perex, tiwai, alsa-devel
Cc: linuxppc-dev, linux-kernel
Some codecs need to configure the sysclk even with slave
mode, otherwise it may not work properly with some case.
wm8960 is the one that need sysclk be configured, so add
late_probe() to call the snd_soc_dai_set_sysclk() of codec
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
sound/soc/fsl/imx-rpmsg.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
index 2e117311e582..bef4bd997c98 100644
--- a/sound/soc/fsl/imx-rpmsg.c
+++ b/sound/soc/fsl/imx-rpmsg.c
@@ -19,6 +19,7 @@
struct imx_rpmsg {
struct snd_soc_dai_link dai;
struct snd_soc_card card;
+ unsigned int sysclk;
};
static const struct snd_soc_dapm_widget imx_rpmsg_dapm_widgets[] = {
@@ -28,6 +29,27 @@ static const struct snd_soc_dapm_widget imx_rpmsg_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Main MIC", NULL),
};
+static int imx_rpmsg_late_probe(struct snd_soc_card *card)
+{
+ struct imx_rpmsg *data = snd_soc_card_get_drvdata(card);
+ struct snd_soc_pcm_runtime *rtd = list_first_entry(&card->rtd_list,
+ struct snd_soc_pcm_runtime, list);
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+ struct device *dev = card->dev;
+ int ret;
+
+ if (!data->sysclk)
+ return 0;
+
+ ret = snd_soc_dai_set_sysclk(codec_dai, 0, data->sysclk, SND_SOC_CLOCK_IN);
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dev, "failed to set sysclk in %s\n", __func__);
+ return ret;
+ }
+
+ return 0;
+}
+
static int imx_rpmsg_probe(struct platform_device *pdev)
{
struct snd_soc_dai_link_component *dlc;
@@ -72,12 +94,18 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
data->dai.codecs->dai_name = "snd-soc-dummy-dai";
data->dai.codecs->name = "snd-soc-dummy";
} else {
+ struct clk *clk;
+
data->dai.codecs->of_node = args.np;
ret = snd_soc_get_dai_name(&args, &data->dai.codecs->dai_name);
if (ret) {
dev_err(&pdev->dev, "Unable to get codec_dai_name\n");
goto fail;
}
+
+ clk = devm_get_clk_from_child(&pdev->dev, args.np, NULL);
+ if (!IS_ERR(clk))
+ data->sysclk = clk_get_rate(clk);
}
data->dai.cpus->dai_name = dev_name(&rpmsg_pdev->dev);
@@ -103,6 +131,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
data->card.owner = THIS_MODULE;
data->card.dapm_widgets = imx_rpmsg_dapm_widgets;
data->card.num_dapm_widgets = ARRAY_SIZE(imx_rpmsg_dapm_widgets);
+ data->card.late_probe = imx_rpmsg_late_probe;
/*
* Inoder to use common api to get card name and audio routing.
* Use parent of_node for this device, revert it after finishing using
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
2022-08-01 12:26 [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai Shengjiu Wang
2022-08-01 17:47 ` Nicolin Chen
@ 2022-08-01 17:47 ` Nicolin Chen
1 sibling, 0 replies; 10+ messages in thread
From: Nicolin Chen @ 2022-08-01 17:47 UTC (permalink / raw)
To: Shengjiu Wang
Cc: Xiubo.Lee, festevam, shengjiu.wang, lgirdwood, broonie, perex,
tiwai, alsa-devel, linuxppc-dev, linux-kernel
On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
> struct imx_rpmsg {
> struct snd_soc_dai_link dai;
> struct snd_soc_card card;
> + unsigned int sysclk;
unsigned long?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
@ 2022-08-01 17:47 ` Nicolin Chen
0 siblings, 0 replies; 10+ messages in thread
From: Nicolin Chen @ 2022-08-01 17:47 UTC (permalink / raw)
To: Shengjiu Wang
Cc: alsa-devel, linuxppc-dev, Xiubo.Lee, festevam, tiwai, lgirdwood,
broonie, shengjiu.wang, linux-kernel
On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
> struct imx_rpmsg {
> struct snd_soc_dai_link dai;
> struct snd_soc_card card;
> + unsigned int sysclk;
unsigned long?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
@ 2022-08-01 17:47 ` Nicolin Chen
0 siblings, 0 replies; 10+ messages in thread
From: Nicolin Chen @ 2022-08-01 17:47 UTC (permalink / raw)
To: Shengjiu Wang
Cc: alsa-devel, linuxppc-dev, Xiubo.Lee, festevam, tiwai, lgirdwood,
perex, broonie, shengjiu.wang, linux-kernel
On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
> struct imx_rpmsg {
> struct snd_soc_dai_link dai;
> struct snd_soc_card card;
> + unsigned int sysclk;
unsigned long?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
2022-08-01 17:47 ` Nicolin Chen
@ 2022-08-02 12:23 ` Shengjiu Wang
-1 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-08-02 12:23 UTC (permalink / raw)
To: Nicolin Chen
Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
Liam Girdwood, Mark Brown, Fabio Estevam, linux-kernel
On Tue, Aug 2, 2022 at 1:47 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com>
> wrote:
>
> > struct imx_rpmsg {
> > struct snd_soc_dai_link dai;
> > struct snd_soc_card card;
> > + unsigned int sysclk;
>
> unsigned long?
>
Seems int or long are all used in the kernel.
I am not sure which one is better?
Best regards
wang shengjiu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
@ 2022-08-02 12:23 ` Shengjiu Wang
0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-08-02 12:23 UTC (permalink / raw)
To: Nicolin Chen
Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
Liam Girdwood, Jaroslav Kysela, Mark Brown, Fabio Estevam,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
On Tue, Aug 2, 2022 at 1:47 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com>
> wrote:
>
> > struct imx_rpmsg {
> > struct snd_soc_dai_link dai;
> > struct snd_soc_card card;
> > + unsigned int sysclk;
>
> unsigned long?
>
Seems int or long are all used in the kernel.
I am not sure which one is better?
Best regards
wang shengjiu
[-- Attachment #2: Type: text/html, Size: 915 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
2022-08-02 12:23 ` Shengjiu Wang
(?)
@ 2022-08-02 13:02 ` Mark Brown
-1 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-08-02 13:02 UTC (permalink / raw)
To: Shengjiu Wang
Cc: Nicolin Chen, Shengjiu Wang, Xiubo Li, Fabio Estevam,
Liam Girdwood, Jaroslav Kysela, Takashi Iwai, alsa-devel,
linuxppc-dev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Tue, Aug 02, 2022 at 08:23:37PM +0800, Shengjiu Wang wrote:
> On Tue, Aug 2, 2022 at 1:47 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> > On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com>
> > wrote:
> > > struct imx_rpmsg {
> > > struct snd_soc_dai_link dai;
> > > struct snd_soc_card card;
> > > + unsigned int sysclk;
> > unsigned long?
> Seems int or long are all used in the kernel.
> I am not sure which one is better?
clk_get_rate() and clk_set_rate() do use unsigned long, but on a lot of
architectures that is the same size as int so it makes little practical
difference though it would be more correct to use an unsigned long.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
@ 2022-08-02 13:02 ` Mark Brown
0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-08-02 13:02 UTC (permalink / raw)
To: Shengjiu Wang
Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
Liam Girdwood, Nicolin Chen, Fabio Estevam, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Tue, Aug 02, 2022 at 08:23:37PM +0800, Shengjiu Wang wrote:
> On Tue, Aug 2, 2022 at 1:47 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> > On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com>
> > wrote:
> > > struct imx_rpmsg {
> > > struct snd_soc_dai_link dai;
> > > struct snd_soc_card card;
> > > + unsigned int sysclk;
> > unsigned long?
> Seems int or long are all used in the kernel.
> I am not sure which one is better?
clk_get_rate() and clk_set_rate() do use unsigned long, but on a lot of
architectures that is the same size as int so it makes little practical
difference though it would be more correct to use an unsigned long.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
@ 2022-08-02 13:02 ` Mark Brown
0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-08-02 13:02 UTC (permalink / raw)
To: Shengjiu Wang
Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
Liam Girdwood, Jaroslav Kysela, Nicolin Chen, Fabio Estevam,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Tue, Aug 02, 2022 at 08:23:37PM +0800, Shengjiu Wang wrote:
> On Tue, Aug 2, 2022 at 1:47 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> > On Mon, Aug 1, 2022 at 5:42 AM Shengjiu Wang <shengjiu.wang@nxp.com>
> > wrote:
> > > struct imx_rpmsg {
> > > struct snd_soc_dai_link dai;
> > > struct snd_soc_card card;
> > > + unsigned int sysclk;
> > unsigned long?
> Seems int or long are all used in the kernel.
> I am not sure which one is better?
clk_get_rate() and clk_set_rate() do use unsigned long, but on a lot of
architectures that is the same size as int so it makes little practical
difference though it would be more correct to use an unsigned long.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai
2022-08-01 12:26 [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai Shengjiu Wang
2022-08-01 17:47 ` Nicolin Chen
@ 2022-08-15 16:22 ` Mark Brown
1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-08-15 16:22 UTC (permalink / raw)
To: lgirdwood, nicoleotsuka, shengjiu.wang, Xiubo.Lee, alsa-devel,
tiwai, festevam, Shengjiu Wang, perex
Cc: linuxppc-dev, linux-kernel
On Mon, 1 Aug 2022 20:26:13 +0800, Shengjiu Wang wrote:
> Some codecs need to configure the sysclk even with slave
> mode, otherwise it may not work properly with some case.
>
> wm8960 is the one that need sysclk be configured, so add
> late_probe() to call the snd_soc_dai_set_sysclk() of codec
>
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: imx-rpmsg: Support configure sysclk for codec dai
commit: 088f115c6ff664c8afe003bd542e1e662a72aaed
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-08-15 16:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 12:26 [PATCH] ASoC: imx-rpmsg: Support configure sysclk for codec dai Shengjiu Wang
2022-08-01 17:47 ` Nicolin Chen
2022-08-01 17:47 ` Nicolin Chen
2022-08-01 17:47 ` Nicolin Chen
2022-08-02 12:23 ` Shengjiu Wang
2022-08-02 12:23 ` Shengjiu Wang
2022-08-02 13:02 ` Mark Brown
2022-08-02 13:02 ` Mark Brown
2022-08-02 13:02 ` Mark Brown
2022-08-15 16:22 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.