All of lore.kernel.org
 help / color / mirror / Atom feed
From: cujomalainey@chromium.org
To: alsa-devel@alsa-project.org
Cc: Akshu Agrawal <akshu.agrawal@amd.com>,
	Curtis Malainey <cujomalainey@chromium.org>,
	Karthik Ramasubramanian <kramasub@google.com>,
	Support Opensource <support.opensource@diasemi.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH] ASoC: da7219: read fmw property to get mclk for non-dts systems
Date: Mon,  4 Mar 2024 13:14:43 -0800	[thread overview]
Message-ID: <20240304211444.1031693-1-cujomalainey@chromium.org> (raw)

From: Akshu Agrawal <akshu.agrawal@amd.com>

Non-dts based systems can use ACPI DSDT to pass on the mclk
to da7219.
This enables da7219 mclk to be linked to system clock.
Enable/Disable of the mclk is already handled in the codec so
platform drivers don't have to explicitly do handling of mclk.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Cc: Karthik Ramasubramanian <kramasub@google.com>
---
 include/sound/da7219.h    | 2 ++
 sound/soc/codecs/da7219.c | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/sound/da7219.h b/include/sound/da7219.h
index dde4542b084f3..4cf4c52be3f7f 100644
--- a/include/sound/da7219.h
+++ b/include/sound/da7219.h
@@ -40,6 +40,8 @@ struct da7219_pdata {
 
 	const char *dai_clk_names[DA7219_DAI_NUM_CLKS];
 
+	const char *mclk_name;
+
 	/* Mic */
 	enum da7219_micbias_voltage micbias_lvl;
 	enum da7219_mic_amp_in_sel mic_amp_in_sel;
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index 311ea7918b312..800f61d993043 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -1782,6 +1782,8 @@ static struct da7219_pdata *da7219_fw_to_pdata(struct device *dev)
 			 pdata->dai_clk_names[DA7219_DAI_WCLK_IDX],
 			 pdata->dai_clk_names[DA7219_DAI_BCLK_IDX]);
 
+	device_property_read_string(dev, "dlg,mclk-name", &pdata->mclk_name);
+
 	if (device_property_read_u32(dev, "dlg,micbias-lvl", &of_val32) >= 0)
 		pdata->micbias_lvl = da7219_fw_micbias_lvl(dev, of_val32);
 	else
@@ -2521,7 +2523,11 @@ static int da7219_probe(struct snd_soc_component *component)
 	da7219_handle_pdata(component);
 
 	/* Check if MCLK provided */
-	da7219->mclk = clk_get(component->dev, "mclk");
+	if (da7219->pdata->mclk_name)
+		da7219->mclk = clk_get(NULL, da7219->pdata->mclk_name);
+	if (!da7219->mclk)
+		da7219->mclk = clk_get(component->dev, "mclk");
+
 	if (IS_ERR(da7219->mclk)) {
 		if (PTR_ERR(da7219->mclk) != -ENOENT) {
 			ret = PTR_ERR(da7219->mclk);
-- 
2.44.0.rc1.240.g4c46232300-goog


             reply	other threads:[~2024-03-04 21:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 21:14 cujomalainey [this message]
2024-03-04 21:23 ` [PATCH] ASoC: da7219: read fmw property to get mclk for non-dts systems Mark Brown
2024-03-04 21:50   ` Curtis Malainey
2024-03-04 22:20     ` Mark Brown
2024-03-05 22:48     ` Curtis Malainey
  -- strict thread matches above, loose matches on Subject: below --
2018-04-30  7:01 Akshu Agrawal
2018-04-30  7:01 ` Akshu Agrawal
2018-04-30  7:01 ` Akshu Agrawal
2018-04-30  7:01   ` Akshu Agrawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240304211444.1031693-1-cujomalainey@chromium.org \
    --to=cujomalainey@chromium.org \
    --cc=akshu.agrawal@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kramasub@google.com \
    --cc=lgirdwood@gmail.com \
    --cc=perex@perex.cz \
    --cc=support.opensource@diasemi.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.