All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Mark Brown <broonie@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: kernel@collabora.com,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	"Chunxu Li" <chunxu.li@mediatek.com>,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Jiaxin Yu" <jiaxin.yu@mediatek.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Takashi Iwai" <tiwai@suse.com>,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: [PATCH 08/10] ASoC: mediatek: mt8186: Allow setting shared clocks from machine driver
Date: Thu,  8 Sep 2022 12:11:52 -0400	[thread overview]
Message-ID: <20220908161154.648557-9-nfraprado@collabora.com> (raw)
In-Reply-To: <20220908161154.648557-1-nfraprado@collabora.com>

Add a new function to configure the shared clock between two i2s ports,
and export it. This will allow the clock sharing to be set from the
machine driver instead of the devicetree.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

 sound/soc/mediatek/mt8186/mt8186-afe-common.h |  3 +++
 sound/soc/mediatek/mt8186/mt8186-dai-i2s.c    | 26 +++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-common.h b/sound/soc/mediatek/mt8186/mt8186-afe-common.h
index b8f03e1b7e49..d59258520995 100644
--- a/sound/soc/mediatek/mt8186/mt8186-afe-common.h
+++ b/sound/soc/mediatek/mt8186/mt8186-afe-common.h
@@ -189,6 +189,9 @@ unsigned int mt8186_rate_transform(struct device *dev,
 unsigned int mt8186_tdm_relatch_rate_transform(struct device *dev,
 					       unsigned int rate);
 
+int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
+			     const char *secondary_i2s_name);
+
 int mt8186_dai_set_priv(struct mtk_base_afe *afe, int id,
 			int priv_size, const void *priv_data);
 
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
index e553a555d168..7e8cad682c83 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
@@ -1184,6 +1184,32 @@ static int mt8186_dai_i2s_get_share(struct mtk_base_afe *afe)
 	return 0;
 }
 
+/**
+ * mt8186_dai_i2s_set_share() - Set up I2S ports to share a single clock.
+ * @afe: Pointer to &struct mtk_base_afe
+ * @main_i2s_name: The name of the I2S port that will provide the clock
+ * @secondary_i2s_name: The name of the I2S port that will use this clock
+ */
+int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
+			     const char *secondary_i2s_name)
+{
+	struct mtk_afe_i2s_priv *secondary_i2s_priv;
+	int main_i2s_id;
+
+	secondary_i2s_priv = get_i2s_priv_by_name(afe, secondary_i2s_name);
+	if (!secondary_i2s_priv)
+		return -EINVAL;
+
+	main_i2s_id = get_i2s_id_by_name(afe, main_i2s_name);
+	if (main_i2s_id < 0)
+		return main_i2s_id;
+
+	secondary_i2s_priv->share_i2s_id = main_i2s_id;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(mt8186_dai_i2s_set_share);
+
 static int mt8186_dai_i2s_set_priv(struct mtk_base_afe *afe)
 {
 	int i;
-- 
2.37.3


WARNING: multiple messages have this Message-ID (diff)
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Mark Brown <broonie@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: alsa-devel@alsa-project.org, "Chunxu Li" <chunxu.li@mediatek.com>,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	linux-kernel@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Jiaxin Yu" <jiaxin.yu@mediatek.com>,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kernel@collabora.com,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH 08/10] ASoC: mediatek: mt8186: Allow setting shared clocks from machine driver
Date: Thu,  8 Sep 2022 12:11:52 -0400	[thread overview]
Message-ID: <20220908161154.648557-9-nfraprado@collabora.com> (raw)
In-Reply-To: <20220908161154.648557-1-nfraprado@collabora.com>

Add a new function to configure the shared clock between two i2s ports,
and export it. This will allow the clock sharing to be set from the
machine driver instead of the devicetree.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

 sound/soc/mediatek/mt8186/mt8186-afe-common.h |  3 +++
 sound/soc/mediatek/mt8186/mt8186-dai-i2s.c    | 26 +++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-common.h b/sound/soc/mediatek/mt8186/mt8186-afe-common.h
index b8f03e1b7e49..d59258520995 100644
--- a/sound/soc/mediatek/mt8186/mt8186-afe-common.h
+++ b/sound/soc/mediatek/mt8186/mt8186-afe-common.h
@@ -189,6 +189,9 @@ unsigned int mt8186_rate_transform(struct device *dev,
 unsigned int mt8186_tdm_relatch_rate_transform(struct device *dev,
 					       unsigned int rate);
 
+int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
+			     const char *secondary_i2s_name);
+
 int mt8186_dai_set_priv(struct mtk_base_afe *afe, int id,
 			int priv_size, const void *priv_data);
 
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
index e553a555d168..7e8cad682c83 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
@@ -1184,6 +1184,32 @@ static int mt8186_dai_i2s_get_share(struct mtk_base_afe *afe)
 	return 0;
 }
 
+/**
+ * mt8186_dai_i2s_set_share() - Set up I2S ports to share a single clock.
+ * @afe: Pointer to &struct mtk_base_afe
+ * @main_i2s_name: The name of the I2S port that will provide the clock
+ * @secondary_i2s_name: The name of the I2S port that will use this clock
+ */
+int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
+			     const char *secondary_i2s_name)
+{
+	struct mtk_afe_i2s_priv *secondary_i2s_priv;
+	int main_i2s_id;
+
+	secondary_i2s_priv = get_i2s_priv_by_name(afe, secondary_i2s_name);
+	if (!secondary_i2s_priv)
+		return -EINVAL;
+
+	main_i2s_id = get_i2s_id_by_name(afe, main_i2s_name);
+	if (main_i2s_id < 0)
+		return main_i2s_id;
+
+	secondary_i2s_priv->share_i2s_id = main_i2s_id;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(mt8186_dai_i2s_set_share);
+
 static int mt8186_dai_i2s_set_priv(struct mtk_base_afe *afe)
 {
 	int i;
-- 
2.37.3


WARNING: multiple messages have this Message-ID (diff)
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Mark Brown <broonie@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: kernel@collabora.com,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	"Chunxu Li" <chunxu.li@mediatek.com>,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Jiaxin Yu" <jiaxin.yu@mediatek.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Takashi Iwai" <tiwai@suse.com>,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: [PATCH 08/10] ASoC: mediatek: mt8186: Allow setting shared clocks from machine driver
Date: Thu,  8 Sep 2022 12:11:52 -0400	[thread overview]
Message-ID: <20220908161154.648557-9-nfraprado@collabora.com> (raw)
In-Reply-To: <20220908161154.648557-1-nfraprado@collabora.com>

Add a new function to configure the shared clock between two i2s ports,
and export it. This will allow the clock sharing to be set from the
machine driver instead of the devicetree.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

 sound/soc/mediatek/mt8186/mt8186-afe-common.h |  3 +++
 sound/soc/mediatek/mt8186/mt8186-dai-i2s.c    | 26 +++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-common.h b/sound/soc/mediatek/mt8186/mt8186-afe-common.h
index b8f03e1b7e49..d59258520995 100644
--- a/sound/soc/mediatek/mt8186/mt8186-afe-common.h
+++ b/sound/soc/mediatek/mt8186/mt8186-afe-common.h
@@ -189,6 +189,9 @@ unsigned int mt8186_rate_transform(struct device *dev,
 unsigned int mt8186_tdm_relatch_rate_transform(struct device *dev,
 					       unsigned int rate);
 
+int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
+			     const char *secondary_i2s_name);
+
 int mt8186_dai_set_priv(struct mtk_base_afe *afe, int id,
 			int priv_size, const void *priv_data);
 
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
index e553a555d168..7e8cad682c83 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-i2s.c
@@ -1184,6 +1184,32 @@ static int mt8186_dai_i2s_get_share(struct mtk_base_afe *afe)
 	return 0;
 }
 
+/**
+ * mt8186_dai_i2s_set_share() - Set up I2S ports to share a single clock.
+ * @afe: Pointer to &struct mtk_base_afe
+ * @main_i2s_name: The name of the I2S port that will provide the clock
+ * @secondary_i2s_name: The name of the I2S port that will use this clock
+ */
+int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
+			     const char *secondary_i2s_name)
+{
+	struct mtk_afe_i2s_priv *secondary_i2s_priv;
+	int main_i2s_id;
+
+	secondary_i2s_priv = get_i2s_priv_by_name(afe, secondary_i2s_name);
+	if (!secondary_i2s_priv)
+		return -EINVAL;
+
+	main_i2s_id = get_i2s_id_by_name(afe, main_i2s_name);
+	if (main_i2s_id < 0)
+		return main_i2s_id;
+
+	secondary_i2s_priv->share_i2s_id = main_i2s_id;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(mt8186_dai_i2s_set_share);
+
 static int mt8186_dai_i2s_set_priv(struct mtk_base_afe *afe)
 {
 	int i;
-- 
2.37.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-09-08 16:12 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 16:11 [PATCH 00/10] ASoC: mediatek: Set i2s clock sharing from machine drivers Nícolas F. R. A. Prado
2022-09-08 16:11 ` Nícolas F. R. A. Prado
2022-09-08 16:11 ` Nícolas F. R. A. Prado
2022-09-08 16:11 ` [PATCH 01/10] ASoC: mediatek: mt8192: Allow setting shared clocks from machine driver Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 02/10] ASoC: mediatek: mt8192-mt6359: Make i2s9 share the clock from i2s8 Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 03/10] ASoC: mediatek: mt8192: Remove clock share parsing from DT Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 04/10] ASoC: mediatek: mt8183: Allow setting shared clocks from machine driver Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 05/10] ASoC: mediatek: mt8183: Configure shared clocks Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 06/10] ASoC: mediatek: mt8183: Remove clock share parsing from DT Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 07/10] arm64: dts: mediatek: kukui: Remove i2s-share properties Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-11-08 12:43   ` Matthias Brugger
2022-11-08 12:43     ` Matthias Brugger
2022-09-08 16:11 ` Nícolas F. R. A. Prado [this message]
2022-09-08 16:11   ` [PATCH 08/10] ASoC: mediatek: mt8186: Allow setting shared clocks from machine driver Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 09/10] ASoC: mediatek: mt8186: Configure shared clocks Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-08 16:11 ` [PATCH 10/10] ASoC: mediatek: mt8186: Remove clock share parsing from DT Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-08 16:11   ` Nícolas F. R. A. Prado
2022-09-09  7:34   ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09  7:34     ` AngeloGioacchino Del Regno
2022-09-09 22:45 ` [PATCH 00/10] ASoC: mediatek: Set i2s clock sharing from machine drivers Mark Brown
2022-09-09 22:45   ` Mark Brown
2022-09-09 22:45   ` Mark Brown
2022-09-13 15:56   ` Matthias Brugger
2022-09-13 15:56     ` Matthias Brugger
2022-09-13 15:56     ` Matthias Brugger
2022-09-13 16:07     ` Mark Brown
2022-09-13 16:07       ` Mark Brown
2022-09-13 16:07       ` Mark Brown
2022-09-13 16:12 ` Mark Brown
2022-09-13 16:12   ` Mark Brown
2022-09-13 16:12   ` Mark Brown

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=20220908161154.648557-9-nfraprado@collabora.com \
    --to=nfraprado@collabora.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=chunxu.li@mediatek.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jiaxin.yu@mediatek.com \
    --cc=kernel@collabora.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=perex@perex.cz \
    --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.