[PATCH] ASoC: mediatek: Change the order of MCLK clock configuration

2016-05-26 Thread PC Liao
Because MCLK opens later and closes earlier than codec, this patch
changes the order of MCLK clock configuration.

Signed-off-by: PC Liao 
---
 sound/soc/mediatek/mtk-afe-pcm.c |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index f1c58a2..440ae06 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -360,8 +360,6 @@ static int mtk_afe_i2s_startup(struct snd_pcm_substream 
*substream,
if (dai->active)
return 0;
 
-   mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S1_M], NULL);
-   mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S2_M], NULL);
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M, 0);
return 0;
@@ -380,8 +378,6 @@ static void mtk_afe_i2s_shutdown(struct snd_pcm_substream 
*substream,
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M);
-   mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S1_M], NULL);
-   mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S2_M], NULL);
 }
 
 static int mtk_afe_i2s_prepare(struct snd_pcm_substream *substream,
@@ -1132,6 +1128,8 @@ static int mtk_afe_runtime_suspend(struct device *dev)
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_AFE, AUD_TCON0_PDN_AFE);
 
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S1_M]);
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S2_M]);
clk_disable_unprepare(afe->clocks[MTK_CLK_BCK0]);
clk_disable_unprepare(afe->clocks[MTK_CLK_BCK1]);
clk_disable_unprepare(afe->clocks[MTK_CLK_TOP_PDN_AUD]);
@@ -1164,6 +1162,12 @@ static int mtk_afe_runtime_resume(struct device *dev)
ret = clk_prepare_enable(afe->clocks[MTK_CLK_BCK1]);
if (ret)
goto err_bck0;
+   ret = clk_prepare_enable(afe->clocks[MTK_CLK_I2S1_M]);
+   if (ret)
+   goto err_i2s1_m;
+   ret = clk_prepare_enable(afe->clocks[MTK_CLK_I2S2_M]);
+   if (ret)
+   goto err_i2s2_m;
 
/* enable AFE clk */
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0, AUD_TCON0_PDN_AFE, 0);
@@ -1179,6 +1183,10 @@ static int mtk_afe_runtime_resume(struct device *dev)
regmap_update_bits(afe->regmap, AFE_DAC_CON0, 0x1, 0x1);
return 0;
 
+err_i2s1_m:
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S1_M]);
+err_i2s2_m:
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S2_M]);
 err_bck0:
clk_disable_unprepare(afe->clocks[MTK_CLK_BCK0]);
 err_top_aud:
-- 
1.7.9.5



[PATCH v2] ASoC: mediatek: Change the order of MCLK clock configuration

2016-05-27 Thread PC Liao
Because MCLK turns on later and turns off earlier than codec, this patch
changes the order of MCLK clock configuration.

Signed-off-by: PC Liao 
---
Changes since v1:
update commit message
---
 sound/soc/mediatek/mtk-afe-pcm.c |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index f1c58a2..440ae06 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -360,8 +360,6 @@ static int mtk_afe_i2s_startup(struct snd_pcm_substream 
*substream,
if (dai->active)
return 0;
 
-   mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S1_M], NULL);
-   mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S2_M], NULL);
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M, 0);
return 0;
@@ -380,8 +378,6 @@ static void mtk_afe_i2s_shutdown(struct snd_pcm_substream 
*substream,
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M);
-   mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S1_M], NULL);
-   mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S2_M], NULL);
 }
 
 static int mtk_afe_i2s_prepare(struct snd_pcm_substream *substream,
@@ -1132,6 +1128,8 @@ static int mtk_afe_runtime_suspend(struct device *dev)
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_AFE, AUD_TCON0_PDN_AFE);
 
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S1_M]);
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S2_M]);
clk_disable_unprepare(afe->clocks[MTK_CLK_BCK0]);
clk_disable_unprepare(afe->clocks[MTK_CLK_BCK1]);
clk_disable_unprepare(afe->clocks[MTK_CLK_TOP_PDN_AUD]);
@@ -1164,6 +1162,12 @@ static int mtk_afe_runtime_resume(struct device *dev)
ret = clk_prepare_enable(afe->clocks[MTK_CLK_BCK1]);
if (ret)
goto err_bck0;
+   ret = clk_prepare_enable(afe->clocks[MTK_CLK_I2S1_M]);
+   if (ret)
+   goto err_i2s1_m;
+   ret = clk_prepare_enable(afe->clocks[MTK_CLK_I2S2_M]);
+   if (ret)
+   goto err_i2s2_m;
 
/* enable AFE clk */
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0, AUD_TCON0_PDN_AFE, 0);
@@ -1179,6 +1183,10 @@ static int mtk_afe_runtime_resume(struct device *dev)
regmap_update_bits(afe->regmap, AFE_DAC_CON0, 0x1, 0x1);
return 0;
 
+err_i2s1_m:
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S1_M]);
+err_i2s2_m:
+   clk_disable_unprepare(afe->clocks[MTK_CLK_I2S2_M]);
 err_bck0:
clk_disable_unprepare(afe->clocks[MTK_CLK_BCK0]);
 err_top_aud:
-- 
1.7.9.5



[PATCH] ASoC: mediatek: Add machine driver for ALC5650 codec

2016-02-18 Thread PC Liao
From: Koro Chen 

This is the DPCM based machine driver with rt5650

Signed-off-by: Nicolas Boichat 
Signed-off-by: Koro Chen 
Signed-off-by: PC Liao 
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|   15 ++
 sound/soc/mediatek/Kconfig |   10 +
 sound/soc/mediatek/Makefile|1 +
 sound/soc/mediatek/mt8173-rt5650.c |  236 
 4 files changed, 262 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
 create mode 100644 sound/soc/mediatek/mt8173-rt5650.c

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
new file mode 100644
index 000..fe5a5ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -0,0 +1,15 @@
+MT8173 with RT5650 CODECS
+
+Required properties:
+- compatible : "mediatek,mt8173-rt5650"
+- mediatek,audio-codec: the phandles of rt5650 codecs
+- mediatek,platform: the phandle of MT8173 ASoC platform
+
+Example:
+
+   sound {
+   compatible = "mediatek,mt8173-rt5650";
+   mediatek,audio-codec = <&rt5650>;
+   mediatek,platform = <&afe>;
+   };
+
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index 9769676..6c88087 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -17,6 +17,16 @@ config SND_SOC_MT8173_MAX98090
  Select Y if you have such device.
  If unsure select "N".
 
+config SND_SOC_MT8173_RT5650
+tristate "ASoC Audio driver for MT8173 with RT5650 codec"
+depends on SND_SOC_MEDIATEK && I2C
+select SND_SOC_RT5645
+help
+  This adds ASoC driver for Mediatek MT8173 boards
+  with the RT5650 audio codec.
+  Select Y if you have such device.
+  If unsure select "N".
+
 config SND_SOC_MT8173_RT5650_RT5676
tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs"
depends on SND_SOC_MEDIATEK && I2C
diff --git a/sound/soc/mediatek/Makefile b/sound/soc/mediatek/Makefile
index 75effbe..bcdcb06 100644
--- a/sound/soc/mediatek/Makefile
+++ b/sound/soc/mediatek/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
 # Machine support
 obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
 obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
+obj-$(CONFIG_SND_SOC_MT8173_RT5650) += mt8173-rt5650.o
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
new file mode 100644
index 000..bb09bb1
--- /dev/null
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -0,0 +1,236 @@
+/*
+ * mt8173-rt5650.c  --  MT8173 machine driver with RT5650 codecs
+ *
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: Koro Chen 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../codecs/rt5645.h"
+
+#define MCLK_FOR_CODECS12288000
+
+static const struct snd_soc_dapm_widget mt8173_rt5650_widgets[] = {
+   SND_SOC_DAPM_SPK("Speaker", NULL),
+   SND_SOC_DAPM_MIC("Int Mic", NULL),
+   SND_SOC_DAPM_HP("Headphone", NULL),
+   SND_SOC_DAPM_MIC("Headset Mic", NULL),
+};
+
+static const struct snd_soc_dapm_route mt8173_rt5650_routes[] = {
+   {"Speaker", NULL, "SPOL"},
+   {"Speaker", NULL, "SPOR"},
+   {"DMIC L1", NULL, "Int Mic"},
+   {"DMIC R1", NULL, "Int Mic"},
+   {"Headphone", NULL, "HPOL"},
+   {"Headphone", NULL, "HPOR"},
+   {"Headset Mic", NULL, "micbias1"},
+   {"Headset Mic", NULL, "micbias2"},
+   {"IN1P", NULL, "Headset Mic"},
+   {"IN1N", NULL, "Headset Mic"},
+};
+
+static const struct snd_kcontrol_new mt8173_rt5650_controls[] = {
+   SOC_DAPM_PIN_SWITCH("Speaker"),
+   SOC_DAPM_PIN_SWITCH("Int Mic"),
+   SOC_DAPM_PIN_SWITCH("Headphone"),
+   SOC_DAPM_PIN_SWITCH("Headset Mic"),
+};
+
+static int mt8173_rt5650_hw_params(struct snd_pcm_substream *substream,
+  struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime

[PATCH] ASoC: mediatek: remove soft reset and add second I2S clock

2016-02-23 Thread PC Liao
To improve I2S flow, this patch removes soft reset and adds second
I2S clock to use.

Signed-off-by: PC Liao 
---
 sound/soc/mediatek/mtk-afe-pcm.c |   14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index 689c51f..3456bfa 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -283,20 +283,13 @@ static void mtk_afe_set_i2s_enable(struct mtk_afe *afe, 
bool enable)
 
regmap_read(afe->regmap, AFE_I2S_CON2, &val);
if (!!(val & AFE_I2S_CON2_EN) == enable)
-   return; /* must skip soft reset */
-
-   /* I2S soft reset begin */
-   regmap_update_bits(afe->regmap, AUDIO_TOP_CON1, 0x4, 0x4);
+   return;
 
/* input */
regmap_update_bits(afe->regmap, AFE_I2S_CON2, 0x1, enable);
 
/* output */
regmap_update_bits(afe->regmap, AFE_I2S_CON1, 0x1, enable);
-
-   /* I2S soft reset end */
-   udelay(1);
-   regmap_update_bits(afe->regmap, AUDIO_TOP_CON1, 0x4, 0);
 }
 
 static int mtk_afe_dais_enable_clks(struct mtk_afe *afe,
@@ -365,6 +358,7 @@ static int mtk_afe_i2s_startup(struct snd_pcm_substream 
*substream,
return 0;
 
mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S1_M], NULL);
+   mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S2_M], NULL);
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M, 0);
return 0;
@@ -384,6 +378,7 @@ static void mtk_afe_i2s_shutdown(struct snd_pcm_substream 
*substream,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M,
   AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M);
mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S1_M], NULL);
+   mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S2_M], NULL);
 }
 
 static int mtk_afe_i2s_prepare(struct snd_pcm_substream *substream,
@@ -397,6 +392,9 @@ static int mtk_afe_i2s_prepare(struct snd_pcm_substream 
*substream,
mtk_afe_dais_set_clks(afe,
  afe->clocks[MTK_CLK_I2S1_M], runtime->rate * 256,
  NULL, 0);
+   mtk_afe_dais_set_clks(afe,
+ afe->clocks[MTK_CLK_I2S2_M], runtime->rate * 256,
+ NULL, 0);
/* config I2S */
ret = mtk_afe_set_i2s(afe, substream->runtime->rate);
if (ret)
-- 
1.7.9.5



[PATCH] ASoC: mediatek: Add I03/I04 widgets and corresponding routes

2016-02-24 Thread PC Liao
From: Koro Chen 

Add these widgets to allow another path from I2S input.

Change-Id: Ib6804bbbde388830d8359245fe13bbb0f2bb36ba
Signed-off-by: Koro Chen 
Signed-off-by: PC Liao 
---
 sound/soc/mediatek/mtk-afe-pcm.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index 689c51f..5de878f 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -40,6 +40,7 @@
 
 #define AFE_CONN1  0x0024
 #define AFE_CONN2  0x0028
+#define AFE_CONN3  0x002c
 #define AFE_CONN7  0x0460
 #define AFE_CONN8  0x0464
 #define AFE_HDMI_CONN0 0x0390
@@ -63,6 +64,7 @@
 #define AFE_HDMI_OUT_CUR   0x0378
 #define AFE_HDMI_OUT_END   0x037c
 
+#define AFE_ADDA_TOP_CON0  0x0120
 #define AFE_ADDA2_TOP_CON0 0x0600
 
 #define AFE_HDMI_OUT_CON0  0x0370
@@ -259,6 +261,7 @@ static int mtk_afe_set_i2s(struct mtk_afe *afe, unsigned 
int rate)
return -EINVAL;
 
/* from external ADC */
+   regmap_update_bits(afe->regmap, AFE_ADDA_TOP_CON0, 0x1, 0x1);
regmap_update_bits(afe->regmap, AFE_ADDA2_TOP_CON0, 0x1, 0x1);
 
/* set input */
@@ -903,15 +906,19 @@ static const struct snd_kcontrol_new mtk_afe_o04_mix[] = {
 };
 
 static const struct snd_kcontrol_new mtk_afe_o09_mix[] = {
+   SOC_DAPM_SINGLE_AUTODISABLE("I03 Switch", AFE_CONN3, 0, 1, 0),
SOC_DAPM_SINGLE_AUTODISABLE("I17 Switch", AFE_CONN7, 30, 1, 0),
 };
 
 static const struct snd_kcontrol_new mtk_afe_o10_mix[] = {
+   SOC_DAPM_SINGLE_AUTODISABLE("I04 Switch", AFE_CONN3, 3, 1, 0),
SOC_DAPM_SINGLE_AUTODISABLE("I18 Switch", AFE_CONN8, 0, 1, 0),
 };
 
 static const struct snd_soc_dapm_widget mtk_afe_pcm_widgets[] = {
/* inter-connections */
+   SND_SOC_DAPM_MIXER("I03", SND_SOC_NOPM, 0, 0, NULL, 0),
+   SND_SOC_DAPM_MIXER("I04", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("I05", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("I06", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("I17", SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -934,12 +941,16 @@ static const struct snd_soc_dapm_route 
mtk_afe_pcm_routes[] = {
{"I2S Playback", NULL, "O04"},
{"VUL", NULL, "O09"},
{"VUL", NULL, "O10"},
+   {"I03", NULL, "I2S Capture"},
+   {"I04", NULL, "I2S Capture"},
{"I17", NULL, "I2S Capture"},
{"I18", NULL, "I2S Capture"},
{ "O03", "I05 Switch", "I05" },
{ "O04", "I06 Switch", "I06" },
{ "O09", "I17 Switch", "I17" },
+   { "O09", "I03 Switch", "I03" },
{ "O10", "I18 Switch", "I18" },
+   { "O10", "I04 Switch", "I04" },
 };
 
 static const struct snd_soc_dapm_route mtk_afe_hdmi_routes[] = {
-- 
1.7.9.5



[PATCH] ASoC: mediatek: Add machine driver for rt5650 rt5514 codec

2016-02-24 Thread PC Liao
From: Koro Chen 

This is the DPCM based machine driver with rt5650 and rt5514.

Signed-off-by: Koro Chen 
Signed-off-by: PC Liao 
---
 .../bindings/sound/mt8173-rt5650-rt5514.txt|   15 ++
 sound/soc/mediatek/Kconfig |   28 ++-
 sound/soc/mediatek/Makefile|3 +-
 sound/soc/mediatek/mt8173-rt5650-rt5514.c  |  258 
 4 files changed, 294 insertions(+), 10 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5514.txt
 create mode 100644 sound/soc/mediatek/mt8173-rt5650-rt5514.c

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5514.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5514.txt
new file mode 100644
index 000..e8b3c80
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5514.txt
@@ -0,0 +1,15 @@
+MT8173 with RT5650 RT5514 CODECS
+
+Required properties:
+- compatible : "mediatek,mt8173-rt5650-rt5514"
+- mediatek,audio-codec: the phandles of rt5650 and rt5514 codecs
+- mediatek,platform: the phandle of MT8173 ASoC platform
+
+Example:
+
+   sound {
+   compatible = "mediatek,mt8173-rt5650-rt5514";
+   mediatek,audio-codec = <&rt5650 &rt5514>;
+   mediatek,platform = <&afe>;
+   };
+
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index 6c88087..f7e789e 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -18,14 +18,25 @@ config SND_SOC_MT8173_MAX98090
  If unsure select "N".
 
 config SND_SOC_MT8173_RT5650
-tristate "ASoC Audio driver for MT8173 with RT5650 codec"
-depends on SND_SOC_MEDIATEK && I2C
-select SND_SOC_RT5645
-help
-  This adds ASoC driver for Mediatek MT8173 boards
-  with the RT5650 audio codec.
-  Select Y if you have such device.
-  If unsure select "N".
+   tristate "ASoC Audio driver for MT8173 with RT5650 codec"
+   depends on SND_SOC_MEDIATEK && I2C
+   select SND_SOC_RT5645
+   help
+ This adds ASoC driver for Mediatek MT8173 boards
+ with the RT5650 audio codec.
+ Select Y if you have such device.
+ If unsure select "N".
+
+config SND_SOC_MT8173_RT5650_RT5514
+   tristate "ASoC Audio driver for MT8173 with RT5650 RT5514 codecs"
+   depends on SND_SOC_MEDIATEK && I2C
+   select SND_SOC_RT5645
+   select SND_SOC_RT5514
+   help
+ This adds ASoC driver for Mediatek MT8173 boards
+ with the RT5650 and RT5514 codecs.
+ Select Y if you have such device.
+ If unsure select "N".
 
 config SND_SOC_MT8173_RT5650_RT5676
tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs"
@@ -37,4 +48,3 @@ config SND_SOC_MT8173_RT5650_RT5676
  with the RT5650 and RT5676 codecs.
  Select Y if you have such device.
  If unsure select "N".
-
diff --git a/sound/soc/mediatek/Makefile b/sound/soc/mediatek/Makefile
index bcdcb06..d486860 100644
--- a/sound/soc/mediatek/Makefile
+++ b/sound/soc/mediatek/Makefile
@@ -2,5 +2,6 @@
 obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
 # Machine support
 obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
-obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
 obj-$(CONFIG_SND_SOC_MT8173_RT5650) += mt8173-rt5650.o
+obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5514) += mt8173-rt5650-rt5514.o
+obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
diff --git a/sound/soc/mediatek/mt8173-rt5650-rt5514.c 
b/sound/soc/mediatek/mt8173-rt5650-rt5514.c
new file mode 100644
index 000..58e0836
--- /dev/null
+++ b/sound/soc/mediatek/mt8173-rt5650-rt5514.c
@@ -0,0 +1,258 @@
+/*
+ * mt8173-rt5650-rt5514.c  --  MT8173 machine driver with RT5650/5514 codecs
+ *
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: Koro Chen 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../codecs/rt5645.h"
+
+#define MCLK_FOR_CODECS12288000
+
+static const struct snd_soc_dapm_widget mt8173_rt5650_rt5514_widgets[] = {
+   SND_SOC_DAPM_SPK("Speaker", NULL),
+   SND_SOC_DAPM_MIC("Int Mic", NULL),
+   SND_SOC_DAPM_HP("Headphone", NULL),
+   SND_SOC_DAPM_MIC("Headset Mic", NULL),
+};

Re: [PATCH] ASoC: mediatek: Add I03/I04 widgets and corresponding routes

2016-02-25 Thread PC Liao
Hi Mark,

On Fri, 2016-02-26 at 10:30 +0800, Mark Brown wrote:
> On Thu, Feb 25, 2016 at 03:12:33PM +0800, PC Liao wrote:
> 
> > Change-Id: Ib6804bbbde388830d8359245fe13bbb0f2bb36ba
> 
> Don't include noise like this in upstream submissions, we don't use your
> gerritt.

Sorry about that.
I will upload new version.
Thanks!




[PATCH 0/2 v6] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-19 Thread PC Liao
Because applied patch (commit 0beeb8d0b434b8b007ac8058fb2cac5997fff6df
"ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver") is 
dropped, I upload new version which include dependent patch.

Changes since v5:
 - add "ASoC: core: export snd_soc_get_dai_name" patch. 
Because snd_soc_of_get_dai_name() fix the property name "sound-dai". 
Our patch needs to change name to use, so export
snd_soc_get_dai_name() which is included in snd_soc_of_get_dai_name(). 

Changes since v4:
Change name from "sound-dai" to "capture-dai" to determine the capture path

Changes since v2,v3:
Fix unclear code and use sound-dai to determine the capture path

Changes since v1:
Use codec dai name to determine the capture path. 


Jean-Francois Moine (1):
  ASoC: core: export snd_soc_get_dai_name

PC Liao (1):
  ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 include/sound/soc.h|2 +
 sound/soc/mediatek/mt8173-rt5650.c |   44 ++--
 sound/soc/soc-core.c   |5 ++-
 4 files changed, 52 insertions(+), 5 deletions(-)

-- 
1.7.9.5



[PATCH 2/2 v6] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-19 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 sound/soc/mediatek/mt8173-rt5650.c |   44 ++--
 2 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..802dd1b 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- capture-dai: audio codec dai on capture path
+  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
+  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   capture-dai = <&rt5650 1>;
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..45dea22 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,26 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_dai_capture = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
+   RT5645_DA_STEREO_FILTER,
RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_dai_capture, "rt5645-aif1")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_dai_capture, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_err(card->dev, "Can't get the right codec dai\n");
+   return -EINVAL;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +124,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +168,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +196,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   const char *codec_dai_capture;
+   struct of_phandle_args args;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +220,23 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (device_property_present(&pdev->dev, "capture-dai")) {
+   ret = of_parse_phandle_with_args(pdev->dev.of_node,
+"capture-dai",
+"#sound-dai-cells", 0, &args);
+   if (ret < 0) {
+   dev_err(&pdev->dev,
+   "%s capture-dai name fail %d\n",
+   __func__, ret);
+   return ret;
+   }
+
+   ret = snd_soc_get_dai_name(&args, &codec_dai_capture);
+   mt8173_rt5650_codecs[1].dai_name = codec_dai_capture;
+   }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
 
-- 
1.7.9.5



[PATCH 1/2 v6] ASoC: core: export snd_soc_get_dai_name

2016-04-19 Thread PC Liao
From: Jean-Francois Moine 

snd_soc_get_dai_name() may be used to define a sound card with
a different syntax from the one of the simple-card.

Signed-off-by: Jean-Francois Moine 
Signed-off-by: PC Liao 
---
 include/sound/soc.h  |2 ++
 sound/soc/soc-core.c |5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 02b4a21..03b2d19 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1669,6 +1669,8 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node 
*np,
 const char *prefix,
 struct device_node **bitclkmaster,
 struct device_node **framemaster);
+int snd_soc_get_dai_name(struct of_phandle_args *args,
+const char **dai_name);
 int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name);
 int snd_soc_of_get_dai_link_codecs(struct device *dev,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d2e62b15..69cbbb0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3786,8 +3786,8 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node 
*np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
 
-static int snd_soc_get_dai_name(struct of_phandle_args *args,
-   const char **dai_name)
+int snd_soc_get_dai_name(struct of_phandle_args *args,
+const char **dai_name)
 {
struct snd_soc_component *pos;
struct device_node *component_of_node;
@@ -3838,6 +3838,7 @@ static int snd_soc_get_dai_name(struct of_phandle_args 
*args,
mutex_unlock(&client_mutex);
return ret;
 }
+EXPORT_SYMBOL_GPL(snd_soc_get_dai_name);
 
 int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name)
-- 
1.7.9.5



Re: [PATCH 2/2 v6] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-20 Thread PC Liao
Hi Mark,

On Wed, 2016-04-20 at 16:29 +0800, Mark Brown wrote:
> On Wed, Apr 20, 2016 at 02:40:47PM +0800, PC Liao wrote:
> 
> > +Optional properties:
> > +- capture-dai: audio codec dai on capture path
> > +  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. 
> > (dai_name = rt5645-aif1)
> > +  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
> 
> I sugggested changing this to use a subnode but you've ignored my
> suggestion...

Sorry It's my mistake.

You mean that using a subnode.
This is my example:

  codec-capture {
  sound-dai = <&rt5650 1>;
  };

Does this is your suggestion?
Thanks!



Re: [PATCH 2/2 v6] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-20 Thread PC Liao
Hi Matthias,

On Wed, 2016-04-20 at 21:30 +0800, Matthias Brugger wrote:
> 
> For compatibility you should change this to something like:
> 
> dev_warn(card->dev, "Only one dai codec found in DTS, enabled rt5645
>  AD filter\n");
> rt5645_sel_asrc_clk_src(codec, RT5645_AD_STEREO_FILTER,
>RT5645_CLK_SEL_I2S1_ASRC);
> }
> 

I will use this in next version.
Thanks!




[PATCH v7] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-20 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
Changes since v6:
Use subnode to determine the capture path
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|   10 
 sound/soc/mediatek/mt8173-rt5650.c |   49 ++--
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..5bfa6b6 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,21 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional subnodes:
+- codec-capture : the subnode of rt5650 codec capture
+Required codec-capture subnode properties:
+- sound-dai: audio codec dai name on capture path
+  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
+  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   codec-capture {
+   sound-dai = <&rt5650 1>;
+   };
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..b8ed965 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,28 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_capture_dai = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
+   RT5645_DA_STEREO_FILTER,
RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_capture_dai, "rt5645-aif1")) {
+   dev_warn(card->dev,
+"Only one dai codec found in DTS, enabled AD 
filter\n");
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_capture_dai, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_err(card->dev, "Can't get the right codec dai\n");
+   return -EINVAL;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +126,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +170,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +198,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   struct device_node *np;
+   const char *codec_capture_dai;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +222,26 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (of_find_node_by_name(platform_node, "codec-capture")) {
+   np = of_get_child_by_name(pdev->dev.of_node, "codec-capture");
+   if (!np) {
+   dev_err(&pdev->dev,
+   

Re: [PATCH 2/2 v6] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-21 Thread PC Liao
Hi Matthias,

On Thu, 2016-04-21 at 17:22 +0800, Matthias Brugger wrote:
> 
> On 20/04/16 18:27, PC Liao wrote:
> > Hi Matthias,
> >
> > On Wed, 2016-04-20 at 21:30 +0800, Matthias Brugger wrote:
> >>
> >> For compatibility you should change this to something like:
> >>
> >>  dev_warn(card->dev, "Only one dai codec found in DTS, enabled rt5645
> >>   AD filter\n");
> >>  rt5645_sel_asrc_clk_src(codec, RT5645_AD_STEREO_FILTER,
> >> RT5645_CLK_SEL_I2S1_ASRC);
> >> }
> >>
> >
> > I will use this in next version.
> > Thanks!
> >
> 
> I think you forgot to add this to v7 of the patches.
> 
> Cheers,
> Matthias

Oh, sorry.
I misunderstand your suggestion.
I will upload.
Thanks!



[PATCH v8] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-21 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
Changes since v7:
Change the code for compatibility
Changes since v6:
Use subnode to determine the capture path
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|   10 
 sound/soc/mediatek/mt8173-rt5650.c |   50 ++--
 2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..5bfa6b6 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,21 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional subnodes:
+- codec-capture : the subnode of rt5650 codec capture
+Required codec-capture subnode properties:
+- sound-dai: audio codec dai name on capture path
+  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
+  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   codec-capture {
+   sound-dai = <&rt5650 1>;
+   };
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..a27a667 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,29 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_capture_dai = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
+   RT5645_DA_STEREO_FILTER,
RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_capture_dai, "rt5645-aif1")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_capture_dai, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_warn(card->dev,
+"Only one dai codec found in DTS, enabled rt5645 AD 
filter\n");
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +127,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +171,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +199,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   struct device_node *np;
+   const char *codec_capture_dai;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +223,26 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (of_find_node_by_name(platform_node, "codec-capture")) {
+   np = of_get_child_by

Re: [PATCH] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-06 Thread PC Liao
Hi Mark,

On Sun, 2016-04-03 at 01:04 +0800, Mark Brown wrote:
> On Fri, Apr 01, 2016 at 10:50:52AM +0800, PC Liao wrote:
> > On Wed, 2016-03-30 at 00:07 +0800, Mark Brown wrote:
> 
> > > This sort of arrangement is very common - it's often needed to get
> > > different sample rates for playback and capture.  Normally it'd be
> > > represented in the DT by having the two DAI links specified normally and
> > > then having the driver look at the DT to see what's connected to work
> > > out what mode to use.
> 
> > Could you please suggest the reference driver about this?
> 
> Any driver that can identify an individual DAI within a device by using
> sound-dai references, even simple-card does this.

Thanks for suggestion.
This machine driver is based on DPCM.
Should I add BE DAI and use DAPM, then using ucm-config(mixer control)
to control the path?
Or, do I think the wrong direction?
Thanks!



[PATCH v3] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-07 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
Changes since v2:
Use sound-dai to determine the capture path.
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 sound/soc/mediatek/mt8173-rt5650.c |   42 ++--
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..4ed768e 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- sound-dai: audio codec dai on capture path
+  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
+  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   sound-dai = <&rt5650 1>;
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..9f56df9 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,26 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_dai_capture = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
-   RT5645_CLK_SEL_I2S1_ASRC);
+   RT5645_DA_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_dai_capture, "rt5645-aif1")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_dai_capture, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_err(card->dev, "Can't get the right codec dai\n");
+   return -EINVAL;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +124,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +168,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +196,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   const char *codec_dai_capture;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +219,20 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (device_property_present(&pdev->dev, "sound-dai")) {
+   ret = snd_soc_of_get_dai_name(pdev->dev.of_node,
+ &codec_dai_capture);
+   if (ret < 0) {
+   dev_err(&pdev->dev,
+   "%s snd_soc_of_get_dai_name fail %d\n",
+   __func__, ret);
+   return ret;
+   }
+   mt8173_rt5650_codecs[1].dai_name = codec_dai_capture;
+   }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
 
-- 
1.7.9.5



Re: [PATCH v3] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-07 Thread PC Liao
Hi Matthias,

On Thu, 2016-04-07 at 17:50 +0800, Matthias Brugger wrote:
> 
> On 07/04/16 09:35, PC Liao wrote:
> > diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
> > b/sound/soc/mediatek/mt8173-rt5650.c
> > index bb09bb1..9f56df9 100644
> > --- a/sound/soc/mediatek/mt8173-rt5650.c
> > +++ b/sound/soc/mediatek/mt8173-rt5650.c
> > @@ -85,12 +85,26 @@ static int mt8173_rt5650_init(struct 
> > snd_soc_pcm_runtime *runtime)
> >   {
> > struct snd_soc_card *card = runtime->card;
> > struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
> > +   const char *codec_dai_capture = runtime->codec_dais[1]->name;
> > int ret;
> >
> > rt5645_sel_asrc_clk_src(codec,
> > -   RT5645_DA_STEREO_FILTER |
> > -   RT5645_AD_STEREO_FILTER,
> > -   RT5645_CLK_SEL_I2S1_ASRC);
> > +   RT5645_DA_STEREO_FILTER,
> > +   RT5645_CLK_SEL_I2S1_ASRC);
> > +
> > +   if (!strcmp(codec_dai_capture, "rt5645-aif1")) {
> > +   rt5645_sel_asrc_clk_src(codec,
> > +   RT5645_AD_STEREO_FILTER,
> > +   RT5645_CLK_SEL_I2S1_ASRC);
> > +   } else if (!strcmp(codec_dai_capture, "rt5645-aif2")) {
> > +   rt5645_sel_asrc_clk_src(codec,
> > +   RT5645_AD_STEREO_FILTER,
> > +   RT5645_CLK_SEL_I2S2_ASRC);
> > +   } else {
> > +   dev_err(card->dev, "Can't get the right codec dai\n");
> > +   return -EINVAL;
> 
> For compatibility issues we should enable RT5645_CLK_SEL_I2S1_ASRC as 
> default. BTW in the old version you enabled DA and AD filter while in 
> the new version you just enable AD filter. What is the reason for that?
> 
> Regards,
> Matthias

Thanks for comment.
I separate rt5645_sel_asrc_clk_src function into two parts.
I have and enable DA filter for I2S1 first.
Then, I use codec_dai_capture to determine which I2S AD filter I need.
Thanks!




Re: [PATCH v3] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-18 Thread PC Liao
Hi Mark,

On Thu, 2016-04-07 at 15:35 +0800, PC Liao wrote:
> This patch adds second I2S connection to rt5650 codec for capture path on
> mt8173-rt5650 machine driver.
> 
> Signed-off-by: PC Liao 
> ---
> Changes since v2:
> Use sound-dai to determine the capture path.
> ---
>  .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
>  sound/soc/mediatek/mt8173-rt5650.c |   42 
> ++--
>  2 files changed, 44 insertions(+), 4 deletions(-)
> 

Could you please give some comments or suggestions?
Thanks!



[PATCH v4] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-18 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
Changes since v2,v3:
Fix unclear code and use sound-dai to determine the capture path
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 sound/soc/mediatek/mt8173-rt5650.c |   40 ++--
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..4ed768e 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- sound-dai: audio codec dai on capture path
+  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
+  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   sound-dai = <&rt5650 1>;
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..f2af2dd 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,26 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_dai_capture = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
+   RT5645_DA_STEREO_FILTER,
RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_dai_capture, "rt5645-aif1")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_dai_capture, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_err(card->dev, "Can't get the right codec dai\n");
+   return -EINVAL;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +124,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +168,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +196,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   const char *codec_dai_capture;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +219,20 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (device_property_present(&pdev->dev, "sound-dai")) {
+   ret = snd_soc_of_get_dai_name(pdev->dev.of_node,
+ &codec_dai_capture);
+   if (ret < 0) {
+   dev_err(&pdev->dev,
+   "%s snd_soc_of_get_dai_name fail %d\n",
+   __func__, ret);
+   return ret;
+   }
+   mt8173_rt5650_codecs[1].dai_name = codec_dai_capture;
+   }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
 
-- 
1.7.9.5



Re: [PATCH v3] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-18 Thread PC Liao
Hi Mark,

On Mon, 2016-04-18 at 20:03 +0800, Mark Brown wrote:
> On Mon, Apr 18, 2016 at 07:36:20PM +0800, PC Liao wrote:
> 
> > Could you please give some comments or suggestions?
> 
> I don't have these patches.  If you're getting review comments from
> other people please address them, it's quite possible I saw them and
> agreed with them.
> 
> Please don't send content free pings and please allow a reasonable time
> for review.  People get busy, go on holiday, attend conferences and so 
> on so unless there is some reason for urgency (like critical bug fixes)
> please allow at least a couple of weeks for review.  Sending content
> free pings just adds to the mail volume (if they are seen at all) and if 
> something has gone wrong you'll have to resend the patches anyway.

I am so sorry about that..
I have sent v4.
Thanks for your review and help.



[PATCH v5] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-19 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

This patch depends on [1], because snd_soc_of_get_dai_name() fix the property 
name "sound-dai". This patch needs to change name to use, so export
snd_soc_get_dai_name() which is included in snd_soc_of_get_dai_name(). 

[1] https://patchwork.kernel.org/patch/5671961/ ("ASoC: core: export
snd_soc_get_dai_name")

Signed-off-by: PC Liao 
---
Changes since v4:
Change name from "sound-dai" to "capture-dai" to determine the capture path
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 sound/soc/mediatek/mt8173-rt5650.c |   44 ++--
 2 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..802dd1b 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- capture-dai: audio codec dai on capture path
+  <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
+  <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   capture-dai = <&rt5650 1>;
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..45dea22 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,26 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_dai_capture = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
+   RT5645_DA_STEREO_FILTER,
RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_dai_capture, "rt5645-aif1")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_dai_capture, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_err(card->dev, "Can't get the right codec dai\n");
+   return -EINVAL;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +124,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +168,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +196,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   const char *codec_dai_capture;
+   struct of_phandle_args args;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +220,23 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (device_property_present(&pdev->dev, "capture-dai")) {
+   ret = of_parse_phandle_with_args

Re: Applied "ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver" to the asoc tree

2016-04-19 Thread PC Liao
Hi Mark,

On Tue, 2016-04-19 at 17:58 +0800, Mark Brown wrote:
> The patch
> 
>ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver
> 
> has been applied to the asoc tree at
> 
>git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
> 
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.  
> 
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
> 
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
> 
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
> 
> Thanks,
> Mark
> 
> From 0beeb8d0b434b8b007ac8058fb2cac5997fff6df Mon Sep 17 00:00:00 2001
> From: PC Liao 
> Date: Tue, 19 Apr 2016 17:46:12 +0800
> Subject: [PATCH] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine
>  driver
> 
> This patch adds second I2S connection to rt5650 codec for capture path on
> mt8173-rt5650 machine driver.
> 
> This patch depends on [1], because snd_soc_of_get_dai_name() fix the property
> name "sound-dai". This patch needs to change name to use, so export
> snd_soc_get_dai_name() which is included in snd_soc_of_get_dai_name().
> 
> [1] https://patchwork.kernel.org/patch/5671961/ ("ASoC: core: export
> snd_soc_get_dai_name")
> 
> Signed-off-by: PC Liao 
> Signed-off-by: Mark Brown 

Thanks for your approval.
But this patch depends on [1].
I think it also needs to apply [1], otherwise this patch will build
fail.
Or, do I need to upload new version again?
Thanks!  

[1] https://patchwork.kernel.org/patch/5671961/ ("ASoC: core: export
snd_soc_get_dai_name")



[PATCH] ASoC: core: export snd_soc_get_dai_name

2016-04-19 Thread PC Liao
From: Jean-Francois Moine 

snd_soc_get_dai_name() may be used to define a sound card with
a different syntax from the one of the simple-card.

Signed-off-by: Jean-Francois Moine 
Signed-off-by: PC Liao 
---
[1] is applied and needs this patch.
Otherwise, [1] will build fail.

[1] https://patchwork.kernel.org/patch/8878491/
("ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver")
---
 include/sound/soc.h  |2 ++
 sound/soc/soc-core.c |5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 02b4a21..03b2d19 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1669,6 +1669,8 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node 
*np,
 const char *prefix,
 struct device_node **bitclkmaster,
 struct device_node **framemaster);
+int snd_soc_get_dai_name(struct of_phandle_args *args,
+const char **dai_name);
 int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name);
 int snd_soc_of_get_dai_link_codecs(struct device *dev,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d2e62b15..69cbbb0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3786,8 +3786,8 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node 
*np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
 
-static int snd_soc_get_dai_name(struct of_phandle_args *args,
-   const char **dai_name)
+int snd_soc_get_dai_name(struct of_phandle_args *args,
+const char **dai_name)
 {
struct snd_soc_component *pos;
struct device_node *component_of_node;
@@ -3838,6 +3838,7 @@ static int snd_soc_get_dai_name(struct of_phandle_args 
*args,
mutex_unlock(&client_mutex);
return ret;
 }
+EXPORT_SYMBOL_GPL(snd_soc_get_dai_name);
 
 int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name)
-- 
1.7.9.5



[PATCH] ASoC: mediatek: HDMI audio LR channel swapped

2016-04-25 Thread PC Liao
Because LRCK of TDM use High to Low as default setting, this patch
changes the TDM setting to inverse LRCK.

Signed-off-by: PC Liao 
---
 sound/soc/mediatek/mtk-afe-pcm.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index f1c58a2..2b5df2e 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -123,6 +123,7 @@
 #define AFE_TDM_CON1_WLEN_32BIT(0x2 << 8)
 #define AFE_TDM_CON1_MSB_ALIGNED   (0x1 << 4)
 #define AFE_TDM_CON1_1_BCK_DELAY   (0x1 << 3)
+#define AFE_TDM_CON1_LRCK_INV  (0x1 << 2)
 #define AFE_TDM_CON1_BCK_INV   (0x1 << 1)
 #define AFE_TDM_CON1_EN(0x1 << 0)
 
@@ -449,6 +450,7 @@ static int mtk_afe_hdmi_prepare(struct snd_pcm_substream 
*substream,
  runtime->rate * runtime->channels * 32);
 
val = AFE_TDM_CON1_BCK_INV |
+ AFE_TDM_CON1_LRCK_INV |
  AFE_TDM_CON1_1_BCK_DELAY |
  AFE_TDM_CON1_MSB_ALIGNED | /* I2S mode */
  AFE_TDM_CON1_WLEN_32BIT |
-- 
1.7.9.5



Re: [PATCH] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-03-31 Thread PC Liao
Hi Mark,

On Wed, 2016-03-30 at 00:07 +0800, Mark Brown wrote:
> On Tue, Mar 29, 2016 at 09:28:23PM +0800, PC Liao wrote:
> 
> > - mediatek,rt5650_i2s: I2S mode of rt5650
> > 0: Default setting. Playback and record path use same set of I2S.
> > Playback/Record path using same I2S clock connect from MT8173 I2S1 to
> > rt5650 I2S1.
> > 1: Playback and record path use different set of I2S. Playback path
> > connects from MT8173 I2S1 to rt5650 I2S1 and record path connects from
> > MT8173 I2S2 to rt5650 I2S2.
> 
> > Because we use codec ASRC function and need to initialize on different
> > setting about this parts:
> 
> This sort of arrangement is very common - it's often needed to get
> different sample rates for playback and capture.  Normally it'd be
> represented in the DT by having the two DAI links specified normally and
> then having the driver look at the DT to see what's connected to work
> out what mode to use.

Could you please suggest the reference driver about this?
Thanks!




[PATCH v2] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-04-01 Thread PC Liao
This patch adds second I2S connection to rt5650 codec for capture path
on mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
Changes since v1:
Use codec dai name to determine the capture path. 
---

 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 sound/soc/mediatek/mt8173-rt5650.c |   39 ++--
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..383cba9 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- mediatek,audio-codec-dai-capture: audio codec dai on capture path
+  rt5645-aif1: Default setting. Connect rt5650 I2S1 for capture
+  rt5645-aif2: Connect rt5650 I2S2 for capture
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   mediatek,audio-codec-dai-capture = "rt5645-aif2";
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..fd2ca66 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -85,12 +85,26 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 {
struct snd_soc_card *card = runtime->card;
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
+   const char *codec_dai_name_capture = runtime->codec_dais[1]->name;
int ret;
 
rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
-   RT5645_CLK_SEL_I2S1_ASRC);
+   RT5645_DA_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+
+   if (!strcmp(codec_dai_name_capture, "rt5645-aif1")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   } else if (!strcmp(codec_dai_name_capture, "rt5645-aif2")) {
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   } else {
+   dev_err(card->dev, "Can't get the right codec dai\n");
+   return -EINVAL;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -110,6 +124,11 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
 
 static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
{
+   /* Playback */
+   .dai_name = "rt5645-aif1",
+   },
+   {
+   /* Capture */
.dai_name = "rt5645-aif1",
},
 };
@@ -149,7 +168,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -177,6 +196,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
 {
struct snd_soc_card *card = &mt8173_rt5650_card;
struct device_node *platform_node;
+   const char *codec_dai_name_capture;
int i, ret;
 
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -199,6 +219,17 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (device_property_present(&pdev->dev,
+   "mediatek,audio-codec-dai-capture")) {
+   device_property_read_string(&pdev->dev,
+   "mediatek,audio-codec-dai-capture",
+   &codec_dai_name_capture);
+
+   mt8173_rt5650_codecs[1].dai_name = codec_dai_name_capture;
+   }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
 
-- 
1.7.9.5



[PATCH] ASoC: mediatek: add MCLK source selection

2016-06-01 Thread PC Liao
The new machine's MCLK source is from mt8173 which is dynamic from
sampling rate*256. This patch provides the selection for device tree.

Signed-off-by: PC Liao 
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|5 +++
 sound/soc/mediatek/mt8173-rt5650.c |   45 +++-
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index 5bfa6b6..f250fc7 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -12,12 +12,17 @@ Required codec-capture subnode properties:
   <&rt5650 0> : Default setting. Connect rt5650 I2S1 for capture. (dai_name = 
rt5645-aif1)
   <&rt5650 1> : Connect rt5650 I2S2 for capture. (dai_name = rt5645-aif2)
 
+- mediatek,mclk: the MCLK source
+  0 : external oscillator, MCLK = 12.288M
+  1 : internal source from mt8173, MCLK = sampling rate*256
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   mediatek,mclk = <0>;
codec-capture {
sound-dai = <&rt5650 1>;
};
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index a27a667..072934b 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -23,6 +23,20 @@
 
 #define MCLK_FOR_CODECS12288000
 
+enum mt8173_rt5650_mclk {
+   MT8173_RT5650_MCLK_EXTERNAL = 0,
+   MT8173_RT5650_MCLK_INTERNAL,
+};
+
+struct mt8173_rt5650_platform_data {
+   enum mt8173_rt5650_mclk pll_from;
+   /* 0 = external oscillator; 1 = internal source from mt8173 */
+};
+
+static struct mt8173_rt5650_platform_data mt8173_rt5650_priv = {
+   .pll_from = MT8173_RT5650_MCLK_EXTERNAL,
+};
+
 static const struct snd_soc_dapm_widget mt8173_rt5650_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
SND_SOC_DAPM_MIC("Int Mic", NULL),
@@ -54,13 +68,29 @@ static int mt8173_rt5650_hw_params(struct snd_pcm_substream 
*substream,
   struct snd_pcm_hw_params *params)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   unsigned int mclk_clock;
int i, ret;
 
+   switch (mt8173_rt5650_priv.pll_from) {
+   case MT8173_RT5650_MCLK_EXTERNAL:
+   /* mclk = 12.288M */
+   mclk_clock = MCLK_FOR_CODECS;
+   break;
+   case MT8173_RT5650_MCLK_INTERNAL:
+   /* mclk = sampling rate*256 */
+   mclk_clock = params_rate(params) * 256;
+   break;
+   default:
+   /* mclk = 12.288M */
+   mclk_clock = MCLK_FOR_CODECS;
+   break;
+   }
+
for (i = 0; i < rtd->num_codecs; i++) {
struct snd_soc_dai *codec_dai = rtd->codec_dais[i];
 
-   /* pll from mclk 12.288M */
-   ret = snd_soc_dai_set_pll(codec_dai, 0, 0, MCLK_FOR_CODECS,
+   /* pll from mclk */
+   ret = snd_soc_dai_set_pll(codec_dai, 0, 0, mclk_clock,
  params_rate(params) * 512);
if (ret)
return ret;
@@ -243,6 +273,17 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
mt8173_rt5650_codecs[1].dai_name = codec_capture_dai;
}
 
+   if (device_property_present(&pdev->dev, "mediatek,mclk")) {
+   ret = device_property_read_u32(&pdev->dev,
+  "mediatek,mclk",
+  &mt8173_rt5650_priv.pll_from);
+   if (ret) {
+   dev_err(&pdev->dev,
+   "%s snd_soc_register_card fail %d\n",
+   __func__, ret);
+   }
+   }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
 
-- 
1.7.9.5



[PATCH] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-03-24 Thread PC Liao
This patch adds second I2S for rt5650 codec on mt8173-rt5650 machine driver.

Signed-off-by: PC Liao 
---
 .../devicetree/bindings/sound/mt8173-rt5650.txt|6 +++
 sound/soc/mediatek/mt8173-rt5650.c |   55 ++--
 2 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt 
b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
index fe5a5ef..0046926 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650.txt
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- mediatek,rt5650_i2s: I2S mode of rt5650
+  0: using I2S1 on rt5650 for record
+  1: using I2S2 on rt5650 for record
+
 Example:
 
sound {
compatible = "mediatek,mt8173-rt5650";
mediatek,audio-codec = <&rt5650>;
mediatek,platform = <&afe>;
+   mediatek,rt5650_i2s = <0>;
};
 
diff --git a/sound/soc/mediatek/mt8173-rt5650.c 
b/sound/soc/mediatek/mt8173-rt5650.c
index bb09bb1..ab4c806 100644
--- a/sound/soc/mediatek/mt8173-rt5650.c
+++ b/sound/soc/mediatek/mt8173-rt5650.c
@@ -23,6 +23,20 @@
 
 #define MCLK_FOR_CODECS12288000
 
+struct mt8173_rt5650_platform_data {
+   unsigned int rt5650_i2s;
+   /* 0 = I2S1; 1 = I2S2 */
+};
+
+static struct mt8173_rt5650_platform_data mt8173_rt5650_priv = {
+   .rt5650_i2s = 0,
+};
+
+enum mt8173_rt5650_i2s {
+   MT8173_RT5650_I2S1 = 0,
+   MT8173_RT5650_I2S2,
+};
+
 static const struct snd_soc_dapm_widget mt8173_rt5650_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
SND_SOC_DAPM_MIC("Int Mic", NULL),
@@ -87,10 +101,25 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime 
*runtime)
struct snd_soc_codec *codec = runtime->codec_dais[0]->codec;
int ret;
 
-   rt5645_sel_asrc_clk_src(codec,
-   RT5645_DA_STEREO_FILTER |
-   RT5645_AD_STEREO_FILTER,
-   RT5645_CLK_SEL_I2S1_ASRC);
+   switch (mt8173_rt5650_priv.rt5650_i2s) {
+   case MT8173_RT5650_I2S1:
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_DA_STEREO_FILTER |
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   break;
+   case MT8173_RT5650_I2S2:
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_DA_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   break;
+   default:
+   break;
+   }
+
/* enable jack detection */
ret = snd_soc_card_jack_new(card, "Headset Jack",
SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
@@ -112,6 +141,9 @@ static struct snd_soc_dai_link_component 
mt8173_rt5650_codecs[] = {
{
.dai_name = "rt5645-aif1",
},
+   {
+   .dai_name = "rt5645-aif2",
+   },
 };
 
 enum {
@@ -149,7 +181,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
.cpu_dai_name = "I2S",
.no_pcm = 1,
.codecs = mt8173_rt5650_codecs,
-   .num_codecs = 1,
+   .num_codecs = 2,
.init = mt8173_rt5650_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
   SND_SOC_DAIFMT_CBS_CFS,
@@ -199,6 +231,19 @@ static int mt8173_rt5650_dev_probe(struct platform_device 
*pdev)
"Property 'audio-codec' missing or invalid\n");
return -EINVAL;
}
+   mt8173_rt5650_codecs[1].of_node = mt8173_rt5650_codecs[0].of_node;
+
+   if (device_property_present(&pdev->dev, "mediatek,rt5650_i2s")) {
+   ret = device_property_read_u32(&pdev->dev,
+  "mediatek,rt5650_i2s",
+  &mt8173_rt5650_priv.rt5650_i2s);
+   if (ret) {
+   dev_err(&pdev->dev,
+   "%s snd_soc_register_card fail %d\n",
+   __func__, ret);
+   }
+   }
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
 
-- 
1.7.9.5



Re: [PATCH] ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

2016-03-29 Thread PC Liao
Hi Mark,

On Tue, 2016-03-29 at 03:11 +0800, Mark Brown wrote:
> On Fri, Mar 25, 2016 at 11:42:05AM +0800, PC Liao wrote:
> 
> > +Optional properties:
> > +- mediatek,rt5650_i2s: I2S mode of rt5650
> > +  0: using I2S1 on rt5650 for record
> > +  1: using I2S2 on rt5650 for record
> > +
> 
> I would expect the machine driver to have a reference to the DAI that is
> in use rather than a property like this.  This is the way pretty much
> all DT based machine drivers work...

Thanks for comment.
I think I need to comment more clearly.
This setting is different connection from MT8173 to rt5650 on hardware.

- mediatek,rt5650_i2s: I2S mode of rt5650
0: Default setting. Playback and record path use same set of I2S.
Playback/Record path using same I2S clock connect from MT8173 I2S1 to
rt5650 I2S1.
1: Playback and record path use different set of I2S. Playback path
connects from MT8173 I2S1 to rt5650 I2S1 and record path connects from
MT8173 I2S2 to rt5650 I2S2.

Because we use codec ASRC function and need to initialize on different
setting about this parts:
+   switch (mt8173_rt5650_priv.rt5650_i2s) {
+   case MT8173_RT5650_I2S1:
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_DA_STEREO_FILTER |
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   break;
+   case MT8173_RT5650_I2S2:
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_DA_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S1_ASRC);
+   rt5645_sel_asrc_clk_src(codec,
+   RT5645_AD_STEREO_FILTER,
+   RT5645_CLK_SEL_I2S2_ASRC);
+   break;
+   default:
+   break;
+   }
, we use device tree to determine which connection we choose.
Does this explain can be accepted?
Thanks!




Re: [PATCH] ASoC: mediatek: Add machine driver for ALC5650 codec

2016-02-21 Thread PC Liao
Hi Mark,

On Fri, 2016-02-19 at 23:37 +0800, Mark Brown wrote:
> On Fri, Feb 19, 2016 at 10:35:59AM +0800, PC Liao wrote:
> 
> > @@ -3,3 +3,4 @@ obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
> >  # Machine support
> >  obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
> >  obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
> > +obj-$(CONFIG_SND_SOC_MT8173_RT5650) += mt8173-rt5650.o
> 
> Why is this not covered by (or coverable by) the existinng RT5650-RT5657
> driver?

Thanks for your review.

Because they are different boards and have some differences like HW
configuration and mixer control, we want to separate machine driver
clearly.

Otherwise, I think I will upload this change to new version for more
clearly.
diff --git a/sound/soc/mediatek/Makefile b/sound/soc/mediatek/Makefile
index bcdcb06..dcb1440 100644
--- a/sound/soc/mediatek/Makefile
+++ b/sound/soc/mediatek/Makefile
@@ -2,5 +2,5 @@
 obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
 # Machine support
 obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
-obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
 obj-$(CONFIG_SND_SOC_MT8173_RT5650) += mt8173-rt5650.o
+obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o