From: Darren.Ye <darren.ye@mediatek.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: <linux-sound@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-gpio@vger.kernel.org>, Darren Ye <darren.ye@mediatek.com>
Subject: [PATCH v2 01/11] ASoC: mediatek: common: modify mtk afe common driver for mt8196
Date: Mon, 7 Apr 2025 20:06:25 +0800 [thread overview]
Message-ID: <20250407120708.26495-2-darren.ye@mediatek.com> (raw)
In-Reply-To: <20250407120708.26495-1-darren.ye@mediatek.com>
From: Darren Ye <darren.ye@mediatek.com>
update the mtk_memif_set_channel interface for the mt8196 platform.
Signed-off-by: Darren Ye <darren.ye@mediatek.com>
---
sound/soc/mediatek/common/mtk-afe-fe-dai.c | 23 +++++++++++++---------
sound/soc/mediatek/common/mtk-afe-fe-dai.h | 1 +
sound/soc/mediatek/common/mtk-base-afe.h | 13 ++++++++++++
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
index 3809068f5620..caf703faf424 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
@@ -459,8 +459,13 @@ int mtk_memif_set_channel(struct mtk_base_afe *afe,
struct mtk_base_afe_memif *memif = &afe->memif[id];
unsigned int mono;
- if (memif->data->mono_shift < 0)
- return 0;
+ dev_dbg(afe->dev, "id: %d, channel: %d\n", id, channel);
+
+ mono = memif->data->mono_invert ^ (channel == 1);
+
+ if (memif->data->mono_shift > 0)
+ mtk_regmap_update_bits(afe->regmap, memif->data->mono_reg,
+ 0x1, mono, memif->data->mono_shift);
if (memif->data->quad_ch_mask) {
unsigned int quad_ch = (channel == 4) ? 1 : 0;
@@ -470,11 +475,6 @@ int mtk_memif_set_channel(struct mtk_base_afe *afe,
quad_ch, memif->data->quad_ch_shift);
}
- if (memif->data->mono_invert)
- mono = (channel == 1) ? 0 : 1;
- else
- mono = (channel == 1) ? 1 : 0;
-
/* for specific configuration of memif mono mode */
if (memif->data->int_odd_flag_reg)
mtk_regmap_update_bits(afe->regmap,
@@ -482,8 +482,13 @@ int mtk_memif_set_channel(struct mtk_base_afe *afe,
1, mono,
memif->data->int_odd_flag_shift);
- return mtk_regmap_update_bits(afe->regmap, memif->data->mono_reg,
- 1, mono, memif->data->mono_shift);
+ if (memif->data->ch_num_maskbit) {
+ mtk_regmap_update_bits(afe->regmap, memif->data->ch_num_reg,
+ memif->data->ch_num_maskbit,
+ channel, memif->data->ch_num_shift);
+ }
+
+ return 0;
}
EXPORT_SYMBOL_GPL(mtk_memif_set_channel);
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.h b/sound/soc/mediatek/common/mtk-afe-fe-dai.h
index b6d0f2b27e86..b720c1dd8012 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.h
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.h
@@ -12,6 +12,7 @@
struct snd_soc_dai_ops;
struct mtk_base_afe;
struct mtk_base_afe_memif;
+struct mtk_base_irq_data;
int mtk_afe_fe_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai);
diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h
index f51578b6c50a..01c27fe92e2f 100644
--- a/sound/soc/mediatek/common/mtk-base-afe.h
+++ b/sound/soc/mediatek/common/mtk-base-afe.h
@@ -53,9 +53,11 @@ struct mtk_base_memif_data {
int enable_reg;
int enable_shift;
int hd_reg;
+ int hd_mask;
int hd_shift;
int hd_align_reg;
int hd_align_mshift;
+ int hd_msb_shift;
int msb_reg;
int msb_shift;
int msb_end_reg;
@@ -65,6 +67,10 @@ struct mtk_base_memif_data {
int ch_num_reg;
int ch_num_shift;
int ch_num_maskbit;
+ /* VUL 24~26 only for CM2 */
+ int out_on_use_reg;
+ int out_on_use_mask;
+ int out_on_use_shift;
/* playback memif only */
int pbuf_reg;
int pbuf_mask;
@@ -72,6 +78,9 @@ struct mtk_base_memif_data {
int minlen_reg;
int minlen_mask;
int minlen_shift;
+ int maxlen_reg;
+ int maxlen_mask;
+ int maxlen_shift;
};
struct mtk_base_irq_data {
@@ -87,6 +96,10 @@ struct mtk_base_irq_data {
int irq_clr_reg;
int irq_clr_shift;
int irq_status_shift;
+ int irq_ap_en_reg;
+ int irq_ap_en_shift;
+ int irq_scp_en_reg;
+ int irq_scp_en_shift;
};
struct device;
--
2.45.2
next prev parent reply other threads:[~2025-04-07 12:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 12:06 [PATCH v2 00/11] ASoC: mediatek: Add support for MT8196 SoC Darren.Ye
2025-04-07 12:06 ` Darren.Ye [this message]
2025-04-07 12:06 ` [PATCH v2 02/11] ASoC: mediatek: common: modify mtk afe platform driver for mt8196 Darren.Ye
2025-04-07 12:06 ` [PATCH v2 03/11] ASoC: mediatek: mt8196: add common header Darren.Ye
2025-04-07 12:06 ` [PATCH v2 04/11] ASoC: mediatek: mt8196: support audio clock control Darren.Ye
2025-04-07 12:06 ` [PATCH v2 05/11] ASoC: mediatek: mt8196: support ADDA in platform driver Darren.Ye
2025-04-07 12:06 ` [PATCH v2 06/11] ASoC: mediatek: mt8196: support I2S " Darren.Ye
2025-04-07 12:06 ` [PATCH v2 07/11] ASoC: mediatek: mt8196: support TDM " Darren.Ye
2025-04-07 12:06 ` [PATCH v2 08/11] ASoC: mediatek: mt8196: add " Darren.Ye
2025-04-09 20:28 ` ALOK TIWARI
2025-04-14 6:37 ` Darren Ye (叶飞)
2025-04-16 11:51 ` Chen-Yu Tsai
2025-04-07 12:06 ` [PATCH v2 09/11] ASoC: dt-bindings: mediatek,mt8196-afe: add audio AFE document Darren.Ye
2025-04-07 13:09 ` Krzysztof Kozlowski
2025-04-16 8:34 ` Chen-Yu Tsai
2025-04-07 12:06 ` [PATCH v2 10/11] ASoC: mediatek: mt8196: add machine driver with mt6681 Darren.Ye
2025-04-07 12:06 ` [PATCH v2 11/11] ASoC: dt-bindings: mediatek,mt8196-mt6681: add mt8196-mt6681 document Darren.Ye
2025-04-07 13:12 ` Krzysztof Kozlowski
2025-04-14 7:08 ` Darren Ye (叶飞)
2025-04-14 12:03 ` Krzysztof Kozlowski
2025-04-07 13:04 ` [PATCH v2 00/11] ASoC: mediatek: Add support for MT8196 SoC Krzysztof Kozlowski
2025-04-08 1:46 ` Darren Ye (叶飞)
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=20250407120708.26495-2-darren.ye@mediatek.com \
--to=darren.ye@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox