All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
@ 2020-07-07 10:08 ` Akshu Agrawal
  0 siblings, 0 replies; 8+ messages in thread
From: Akshu Agrawal @ 2020-07-07 10:08 UTC (permalink / raw)
  Cc: akshu.agrawal, Oder Chiou, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, moderated list:SOUND, open list

Non-dts based systems can use ACPI DSDT to pass on the mclk.
Thus add fmw property mclk-name to get the name of the system clk
and link it to rt5682 mclk.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
---
 include/sound/rt5682.h    | 1 +
 sound/soc/codecs/rt5682.c | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index e1f790561ac1..8717c02f89b8 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -42,6 +42,7 @@ struct rt5682_platform_data {
 	unsigned int dmic_delay;
 
 	const char *dai_clk_names[RT5682_DAI_NUM_CLKS];
+	const char *mclk_name;
 };
 
 #endif
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index de40b6cd16cf..8b223bd0929e 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -2849,7 +2849,10 @@ static int rt5682_probe(struct snd_soc_component *component)
 	} else {
 #ifdef CONFIG_COMMON_CLK
 		/* Check if MCLK provided */
-		rt5682->mclk = devm_clk_get(component->dev, "mclk");
+		if (rt5682->pdata.mclk_name)
+			rt5682->mclk = clk_get(NULL, rt5682->pdata.mclk_name);
+		if (!rt5682->mclk)
+			rt5682->mclk = devm_clk_get(component->dev, "mclk");
 		if (IS_ERR(rt5682->mclk)) {
 			if (PTR_ERR(rt5682->mclk) != -ENOENT) {
 				ret = PTR_ERR(rt5682->mclk);
@@ -2976,6 +2979,8 @@ int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
 			 rt5682->pdata.dai_clk_names[RT5682_DAI_WCLK_IDX],
 			 rt5682->pdata.dai_clk_names[RT5682_DAI_BCLK_IDX]);
 
+	device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(rt5682_parse_dt);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
@ 2020-07-07 10:08 ` Akshu Agrawal
  0 siblings, 0 replies; 8+ messages in thread
From: Akshu Agrawal @ 2020-07-07 10:08 UTC (permalink / raw)
  Cc: Oder Chiou, moderated list:SOUND, open list, Takashi Iwai,
	Liam Girdwood, Mark Brown, akshu.agrawal

Non-dts based systems can use ACPI DSDT to pass on the mclk.
Thus add fmw property mclk-name to get the name of the system clk
and link it to rt5682 mclk.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
---
 include/sound/rt5682.h    | 1 +
 sound/soc/codecs/rt5682.c | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index e1f790561ac1..8717c02f89b8 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -42,6 +42,7 @@ struct rt5682_platform_data {
 	unsigned int dmic_delay;
 
 	const char *dai_clk_names[RT5682_DAI_NUM_CLKS];
+	const char *mclk_name;
 };
 
 #endif
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index de40b6cd16cf..8b223bd0929e 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -2849,7 +2849,10 @@ static int rt5682_probe(struct snd_soc_component *component)
 	} else {
 #ifdef CONFIG_COMMON_CLK
 		/* Check if MCLK provided */
-		rt5682->mclk = devm_clk_get(component->dev, "mclk");
+		if (rt5682->pdata.mclk_name)
+			rt5682->mclk = clk_get(NULL, rt5682->pdata.mclk_name);
+		if (!rt5682->mclk)
+			rt5682->mclk = devm_clk_get(component->dev, "mclk");
 		if (IS_ERR(rt5682->mclk)) {
 			if (PTR_ERR(rt5682->mclk) != -ENOENT) {
 				ret = PTR_ERR(rt5682->mclk);
@@ -2976,6 +2979,8 @@ int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
 			 rt5682->pdata.dai_clk_names[RT5682_DAI_WCLK_IDX],
 			 rt5682->pdata.dai_clk_names[RT5682_DAI_BCLK_IDX]);
 
+	device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(rt5682_parse_dt);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
  2020-07-07 10:08 ` Akshu Agrawal
@ 2020-07-07 10:30   ` Mark Brown
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-07-07 10:30 UTC (permalink / raw)
  To: Akshu Agrawal
  Cc: Oder Chiou, Jaroslav Kysela, Takashi Iwai, Liam Girdwood,
	moderated list:SOUND, open list

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

On Tue, Jul 07, 2020 at 03:38:25PM +0530, Akshu Agrawal wrote:
> Non-dts based systems can use ACPI DSDT to pass on the mclk.
> Thus add fmw property mclk-name to get the name of the system clk
> and link it to rt5682 mclk.

ACPI doesn't support clocks at all, you need to add a clock binding to
ACPI first.  The idiomatic way to do this would be to have board
specific quirks.

> +	device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
> +

No, this is not at all OK - you're adding this via a device property
which means that this will show up in the DT bindings too.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
@ 2020-07-07 10:30   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-07-07 10:30 UTC (permalink / raw)
  To: Akshu Agrawal
  Cc: Oder Chiou, moderated list:SOUND, open list, Liam Girdwood, Takashi Iwai

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

On Tue, Jul 07, 2020 at 03:38:25PM +0530, Akshu Agrawal wrote:
> Non-dts based systems can use ACPI DSDT to pass on the mclk.
> Thus add fmw property mclk-name to get the name of the system clk
> and link it to rt5682 mclk.

ACPI doesn't support clocks at all, you need to add a clock binding to
ACPI first.  The idiomatic way to do this would be to have board
specific quirks.

> +	device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
> +

No, this is not at all OK - you're adding this via a device property
which means that this will show up in the DT bindings too.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
  2020-07-07 10:30   ` Mark Brown
@ 2020-07-13  1:16     ` Agrawal, Akshu
  -1 siblings, 0 replies; 8+ messages in thread
From: Agrawal, Akshu @ 2020-07-13  1:16 UTC (permalink / raw)
  To: Mark Brown, Akshu Agrawal
  Cc: Oder Chiou, Jaroslav Kysela, Takashi Iwai, Liam Girdwood,
	moderated list:SOUND, open list


On 7/7/2020 4:00 PM, Mark Brown wrote:
> On Tue, Jul 07, 2020 at 03:38:25PM +0530, Akshu Agrawal wrote:
>> Non-dts based systems can use ACPI DSDT to pass on the mclk.
>> Thus add fmw property mclk-name to get the name of the system clk
>> and link it to rt5682 mclk.
> ACPI doesn't support clocks at all, you need to add a clock binding to
> ACPI first.  The idiomatic way to do this would be to have board
> specific quirks.

clk binding is present for AMD ST platform and using the same.

With recent submitted patches I am making them generic for all AMD 
platforms.

Please refer patches:

https://patchwork.kernel.org/patch/11658505/

https://patchwork.kernel.org/patch/11658507/

Thanks,

Akshu

>
>> +	device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
>> +
> No, this is not at all OK - you're adding this via a device property
> which means that this will show up in the DT bindings too.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
@ 2020-07-13  1:16     ` Agrawal, Akshu
  0 siblings, 0 replies; 8+ messages in thread
From: Agrawal, Akshu @ 2020-07-13  1:16 UTC (permalink / raw)
  To: Mark Brown, Akshu Agrawal
  Cc: Oder Chiou, moderated list:SOUND, open list, Liam Girdwood, Takashi Iwai


On 7/7/2020 4:00 PM, Mark Brown wrote:
> On Tue, Jul 07, 2020 at 03:38:25PM +0530, Akshu Agrawal wrote:
>> Non-dts based systems can use ACPI DSDT to pass on the mclk.
>> Thus add fmw property mclk-name to get the name of the system clk
>> and link it to rt5682 mclk.
> ACPI doesn't support clocks at all, you need to add a clock binding to
> ACPI first.  The idiomatic way to do this would be to have board
> specific quirks.

clk binding is present for AMD ST platform and using the same.

With recent submitted patches I am making them generic for all AMD 
platforms.

Please refer patches:

https://patchwork.kernel.org/patch/11658505/

https://patchwork.kernel.org/patch/11658507/

Thanks,

Akshu

>
>> +	device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
>> +
> No, this is not at all OK - you're adding this via a device property
> which means that this will show up in the DT bindings too.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
  2020-07-13  1:16     ` Agrawal, Akshu
@ 2020-07-13 10:52       ` Mark Brown
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-07-13 10:52 UTC (permalink / raw)
  To: Agrawal, Akshu
  Cc: Akshu Agrawal, Oder Chiou, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, moderated list:SOUND, open list

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

On Mon, Jul 13, 2020 at 06:46:29AM +0530, Agrawal, Akshu wrote:

> clk binding is present for AMD ST platform and using the same.

This is something you should be doing through UEFI forum as a generic
ACPI thing, and if you need to read the name from the firmware that
really does sound like something that should be raising red flags as a
binding.

> With recent submitted patches I am making them generic for all AMD
> platforms.

> Please refer patches:

> https://patchwork.kernel.org/patch/11658505/

> https://patchwork.kernel.org/patch/11658507/

It looks like there's clock names hard coded into the driver?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: rt5682: Add fmw property to get name of mclk
@ 2020-07-13 10:52       ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-07-13 10:52 UTC (permalink / raw)
  To: Agrawal, Akshu
  Cc: Oder Chiou, moderated list:SOUND, open list, Takashi Iwai,
	Liam Girdwood, Akshu Agrawal

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

On Mon, Jul 13, 2020 at 06:46:29AM +0530, Agrawal, Akshu wrote:

> clk binding is present for AMD ST platform and using the same.

This is something you should be doing through UEFI forum as a generic
ACPI thing, and if you need to read the name from the firmware that
really does sound like something that should be raising red flags as a
binding.

> With recent submitted patches I am making them generic for all AMD
> platforms.

> Please refer patches:

> https://patchwork.kernel.org/patch/11658505/

> https://patchwork.kernel.org/patch/11658507/

It looks like there's clock names hard coded into the driver?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-13 10:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 10:08 [PATCH] ASoC: rt5682: Add fmw property to get name of mclk Akshu Agrawal
2020-07-07 10:08 ` Akshu Agrawal
2020-07-07 10:30 ` Mark Brown
2020-07-07 10:30   ` Mark Brown
2020-07-13  1:16   ` Agrawal, Akshu
2020-07-13  1:16     ` Agrawal, Akshu
2020-07-13 10:52     ` Mark Brown
2020-07-13 10:52       ` 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.