* [PATCH 0/2] ASoC: Mediatek: Add mt8183-mt6358 machine driver
@ 2019-03-05 4:06 Shunli Wang
[not found] ` <1551758805-34880-1-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Shunli Wang @ 2019-03-05 4:06 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
garlic.tseng-NuS5LvNUpcJWk0Htik3J/w,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
shunli.wang-NuS5LvNUpcJWk0Htik3J/w,
kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w
This patch adds machine driver which uses MT8183 as SoC and
MT6358 as external codec.
The patch is based on broonie tree "for-next" branch
Shunli Wang (2):
ASoC: mediatek: mt8183: add mt8183-mt6358 machine driver
ASoC: mediatek: add document for mt8183-mt6358
.../devicetree/bindings/sound/mt8183-mt6358.txt | 12 ++
sound/soc/mediatek/Kconfig | 10 +
sound/soc/mediatek/mt8183/mt8183-mt6358.c | 201 +++++++++++++++++++++
3 files changed, 223 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/mt8183-mt6358.txt
create mode 100644 sound/soc/mediatek/mt8183/mt8183-mt6358.c
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ASoC: mediatek: mt8183: add mt8183-mt6358 machine driver
[not found] ` <1551758805-34880-1-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2019-03-05 4:06 ` Shunli Wang
[not found] ` <1551758805-34880-2-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-03-05 4:06 ` [PATCH 2/2] ASoC: mediatek: add document for mt8183-mt6358 Shunli Wang
1 sibling, 1 reply; 4+ messages in thread
From: Shunli Wang @ 2019-03-05 4:06 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
garlic.tseng-NuS5LvNUpcJWk0Htik3J/w,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
shunli.wang-NuS5LvNUpcJWk0Htik3J/w,
kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w
The board uses mt8183 as SoC and codec as mt6358.
Between SoC and codec, a mtk-properity audio inferface
is used.
Signed-off-by: Shunli Wang <shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
sound/soc/mediatek/Kconfig | 10 ++
sound/soc/mediatek/mt8183/mt8183-mt6358.c | 201 ++++++++++++++++++++++++++++++
2 files changed, 211 insertions(+)
create mode 100644 sound/soc/mediatek/mt8183/mt8183-mt6358.c
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index b35410e..c1d402a 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -116,6 +116,16 @@ config SND_SOC_MT8183
Select Y if you have such device.
If unsure select "N".
+config SND_SOC_MT8183_MT6358
+ tristate "ASoc Audio driver for MT8183 with MT6358 codec"
+ depends on SND_SOC_MT8183 && MTK_PMIC_WRAP
+ select SND_SOC_MT8183
+ help
+ This adds ASoC driver for Mediatek MT8183 boards
+ with the MT6358 codecs.
+ Select Y if you have such device.
+ If unsure select "N".
+
config SND_SOC_MTK_BTCVSD
tristate "ALSA BT SCO CVSD/MSBC Driver"
help
diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358.c b/sound/soc/mediatek/mt8183/mt8183-mt6358.c
new file mode 100644
index 0000000..08366bc
--- /dev/null
+++ b/sound/soc/mediatek/mt8183/mt8183-mt6358.c
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// mt8183-mt6358.c
+// -- MT8183-MT6358 ALSA SoC machine driver
+//
+// Copyright (c) 2018 MediaTek Inc.
+// Author: KaiChieh Chuang <kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
+
+#include <linux/module.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+#include <linux/pinctrl/consumer.h>
+
+#include "mt8183-afe-common.h"
+
+static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ unsigned int rate = params_rate(params);
+ unsigned int mclk_fs_ratio = 128;
+ unsigned int mclk_fs = rate * mclk_fs_ratio;
+
+ return snd_soc_dai_set_sysclk(rtd->cpu_dai,
+ 0, mclk_fs, SND_SOC_CLOCK_OUT);
+}
+
+static const struct snd_soc_ops mt8183_mt6358_i2s_ops = {
+ .hw_params = mt8183_mt6358_i2s_hw_params,
+};
+
+static struct snd_soc_dai_link mt8183_mt6358_dai_links[] = {
+ /* FE */
+ {
+ .name = "Playback_1",
+ .stream_name = "Playback_1",
+ .cpu_dai_name = "DL1",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_playback = 1,
+ },
+ {
+ .name = "Playback_2",
+ .stream_name = "Playback_2",
+ .cpu_dai_name = "DL2",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_playback = 1,
+ },
+ {
+ .name = "Playback_3",
+ .stream_name = "Playback_3",
+ .cpu_dai_name = "DL3",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_playback = 1,
+ },
+ {
+ .name = "Capture_1",
+ .stream_name = "Capture_1",
+ .cpu_dai_name = "UL1",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_capture = 1,
+ },
+ {
+ .name = "Capture_2",
+ .stream_name = "Capture_2",
+ .cpu_dai_name = "UL2",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_capture = 1,
+ },
+ {
+ .name = "Capture_3",
+ .stream_name = "Capture_3",
+ .cpu_dai_name = "UL3",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_capture = 1,
+ },
+ {
+ .name = "Capture_Mono_1",
+ .stream_name = "Capture_Mono_1",
+ .cpu_dai_name = "UL_MONO_1",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
+ SND_SOC_DPCM_TRIGGER_PRE},
+ .dynamic = 1,
+ .dpcm_capture = 1,
+ },
+ /* BE */
+ {
+ .name = "Primary Codec",
+ .cpu_dai_name = "ADDA",
+ .codec_dai_name = "mt6358-snd-codec-aif1",
+ .codec_name = "snd-soc-dummy",
+ .codec_dai_name = "snd-soc-dummy-dai",
+ .no_pcm = 1,
+ .dpcm_playback = 1,
+ .dpcm_capture = 1,
+ .ignore_suspend = 1,
+ },
+};
+
+static struct snd_soc_card mt8183_mt6358_card = {
+ .name = "mt8183-mt6358",
+ .owner = THIS_MODULE,
+ .dai_link = mt8183_mt6358_dai_links,
+ .num_links = ARRAY_SIZE(mt8183_mt6358_dai_links),
+};
+
+static int mt8183_mt6358_dev_probe(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = &mt8183_mt6358_card;
+ struct device_node *platform_node;
+ struct snd_soc_dai_link *dai_link;
+ struct pinctrl *default_pins;
+ int ret, i;
+
+ card->dev = &pdev->dev;
+
+ platform_node = of_parse_phandle(pdev->dev.of_node,
+ "mediatek,platform", 0);
+ if (!platform_node) {
+ dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
+ return -EINVAL;
+ }
+
+ for_each_card_prelinks(card, i, dai_link) {
+ dai_link->platform = NULL;
+
+ if (dai_link->platform_name)
+ continue;
+ dai_link->platform_of_node = platform_node;
+ }
+
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
+ if (ret) {
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
+ __func__, ret);
+ return ret;
+ }
+
+ default_pins =
+ devm_pinctrl_get_select(&pdev->dev, PINCTRL_STATE_DEFAULT);
+ if (IS_ERR(default_pins)) {
+ dev_err(&pdev->dev, "%s set pins failed\n",
+ __func__);
+ return PTR_ERR(default_pins);
+ }
+
+ return ret;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id mt8183_mt6358_dt_match[] = {
+ {.compatible = "mediatek,mt8183-mt6358-sound",},
+ {}
+};
+#endif
+
+static struct platform_driver mt8183_mt6358_driver = {
+ .driver = {
+ .name = "mt8183-mt6358",
+ .owner = THIS_MODULE,
+#ifdef CONFIG_OF
+ .of_match_table = mt8183_mt6358_dt_match,
+#endif
+ },
+ .probe = mt8183_mt6358_dev_probe,
+};
+
+module_platform_driver(mt8183_mt6358_driver);
+
+/* Module information */
+MODULE_DESCRIPTION("MT8183-MT6358 ALSA SoC machine driver");
+MODULE_AUTHOR("KaiChieh Chuang <kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("mt8183_mt6358 sound card");
+
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ASoC: mediatek: add document for mt8183-mt6358
[not found] ` <1551758805-34880-1-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-03-05 4:06 ` [PATCH 1/2] ASoC: mediatek: mt8183: add " Shunli Wang
@ 2019-03-05 4:06 ` Shunli Wang
1 sibling, 0 replies; 4+ messages in thread
From: Shunli Wang @ 2019-03-05 4:06 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
garlic.tseng-NuS5LvNUpcJWk0Htik3J/w,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
shunli.wang-NuS5LvNUpcJWk0Htik3J/w,
kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w
A device node usage notice for the machine with mt8183 as soc
and mt6358 as codec.
Signed-off-by: Shunli Wang <shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
Documentation/devicetree/bindings/sound/mt8183-mt6358.txt | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/mt8183-mt6358.txt
diff --git a/Documentation/devicetree/bindings/sound/mt8183-mt6358.txt b/Documentation/devicetree/bindings/sound/mt8183-mt6358.txt
new file mode 100644
index 0000000..75b19f3
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/mt8183-mt6358.txt
@@ -0,0 +1,12 @@
+MT8183 with MT6358 CODEC
+
+Required properties:
+- compatible: "mediatek,mt8183-mt6358-sound"
+- mediatek,platform: the phandle of MT8183 ASoC platform
+
+Example:
+
+ sound {
+ compatible = "mediatek,mt8183-mt6358-sound";
+ mediatek,platform = <&afe>;
+ };
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: mediatek: mt8183: add mt8183-mt6358 machine driver
[not found] ` <1551758805-34880-2-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2019-03-21 14:54 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-03-21 14:54 UTC (permalink / raw)
To: Shunli Wang
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
garlic.tseng-NuS5LvNUpcJWk0Htik3J/w,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
srv_heupstream-NuS5LvNUpcJWk0Htik3J/w,
kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w
[-- Attachment #1.1: Type: text/plain, Size: 618 bytes --]
On Tue, Mar 05, 2019 at 12:06:44PM +0800, Shunli Wang wrote:
> +config SND_SOC_MT8183_MT6358
> + tristate "ASoc Audio driver for MT8183 with MT6358 codec"
> + depends on SND_SOC_MT8183 && MTK_PMIC_WRAP
> + select SND_SOC_MT8183
> + help
This doesn't build:
scripts/kconfig/conf --oldconfig Kconfig
sound/soc/mediatek/Kconfig:119:error: recursive dependency detected!
sound/soc/mediatek/Kconfig:119: symbol SND_SOC_MT8183_MT6358 depends on SND_SOC_MT8183
sound/soc/mediatek/Kconfig:109: symbol SND_SOC_MT8183 is selected by SND_SOC_MT8183_MT6358
For a resolution refer to Documentation/kbuild/kconfig-language.txt
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 200 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-21 14:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 4:06 [PATCH 0/2] ASoC: Mediatek: Add mt8183-mt6358 machine driver Shunli Wang
[not found] ` <1551758805-34880-1-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-03-05 4:06 ` [PATCH 1/2] ASoC: mediatek: mt8183: add " Shunli Wang
[not found] ` <1551758805-34880-2-git-send-email-shunli.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-03-21 14:54 ` Mark Brown
2019-03-05 4:06 ` [PATCH 2/2] ASoC: mediatek: add document for mt8183-mt6358 Shunli Wang
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.