All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
@ 2017-02-25 12:30 ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

Lichee Pi Zero features a dock, which adds some functions, and should be
soldered with the core board of Lichee Pi Zero.

Add support for the dock as a new dts, as soldering is needed to make
the dock usable and there's functions enabled on the dock that is
unavailable at the 2.54mm pins of the core board.

Currently no new feature on core board is available in the mainline
kernel, so the dock dt file only includes the core board device tree.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/Makefile                         |  3 +-
 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 49 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 011808490fed..1aa365306479 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -876,7 +876,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-h3-orangepi-plus.dtb \
 	sun8i-h3-orangepi-plus2e.dtb \
 	sun8i-r16-parrot.dtb \
-	sun8i-v3s-licheepi-zero.dtb
+	sun8i-v3s-licheepi-zero.dtb \
+	sun8i-v3s-licheepi-zero-dock.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
 	sun9i-a80-optimus.dtb \
 	sun9i-a80-cubieboard4.dtb
diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
new file mode 100644
index 000000000000..68c114d6b939
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun8i-v3s-licheepi-zero.dts"
+
+/ {
+	model = "Lichee Pi Zero with Dock";
+	compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
+		     "allwinner,sun8i-v3s";
+};
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
@ 2017-02-25 12:30 ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

Lichee Pi Zero features a dock, which adds some functions, and should be
soldered with the core board of Lichee Pi Zero.

Add support for the dock as a new dts, as soldering is needed to make
the dock usable and there's functions enabled on the dock that is
unavailable at the 2.54mm pins of the core board.

Currently no new feature on core board is available in the mainline
kernel, so the dock dt file only includes the core board device tree.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/Makefile                         |  3 +-
 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 49 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 011808490fed..1aa365306479 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -876,7 +876,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-h3-orangepi-plus.dtb \
 	sun8i-h3-orangepi-plus2e.dtb \
 	sun8i-r16-parrot.dtb \
-	sun8i-v3s-licheepi-zero.dtb
+	sun8i-v3s-licheepi-zero.dtb \
+	sun8i-v3s-licheepi-zero-dock.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
 	sun9i-a80-optimus.dtb \
 	sun9i-a80-cubieboard4.dtb
diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
new file mode 100644
index 000000000000..68c114d6b939
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun8i-v3s-licheepi-zero.dts"
+
+/ {
+	model = "Lichee Pi Zero with Dock";
+	compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
+		     "allwinner,sun8i-v3s";
+};
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 2/9] ASoC: sun8i-codec-analog: split out linein and mic2
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

Allwinner V3s SoC features an analog codec without linein and mic2.

Split out them, in order to prepare for the analog codec on V3s.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 sound/soc/sunxi/sun8i-codec-analog.c | 168 +++++++++++++++++++++++++++++------
 1 file changed, 141 insertions(+), 27 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 72331332b72e..6c17c99c2c8d 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -252,24 +252,15 @@ static const DECLARE_TLV_DB_RANGE(sun8i_codec_mic_gain_scale,
 );
 
 static const struct snd_kcontrol_new sun8i_codec_common_controls[] = {
-	/* Mixer pre-gains */
-	SOC_SINGLE_TLV("Line In Playback Volume", SUN8I_ADDA_LINEIN_GCTRL,
-		       SUN8I_ADDA_LINEIN_GCTRL_LINEING,
-		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
+	/* Mixer pre-gain */
 	SOC_SINGLE_TLV("Mic1 Playback Volume", SUN8I_ADDA_MICIN_GCTRL,
 		       SUN8I_ADDA_MICIN_GCTRL_MIC1G,
 		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
-	SOC_SINGLE_TLV("Mic2 Playback Volume",
-		       SUN8I_ADDA_MICIN_GCTRL, SUN8I_ADDA_MICIN_GCTRL_MIC2G,
-		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
 
-	/* Microphone Amp boost gains */
+	/* Microphone Amp boost gain */
 	SOC_SINGLE_TLV("Mic1 Boost Volume", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
 		       SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MIC1BOOST, 0x7, 0,
 		       sun8i_codec_mic_gain_scale),
-	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN8I_ADDA_MIC2G_CTRL,
-		       SUN8I_ADDA_MIC2G_CTRL_MIC2BOOST, 0x7, 0,
-		       sun8i_codec_mic_gain_scale),
 
 	/* ADC */
 	SOC_SINGLE_TLV("ADC Gain Capture Volume", SUN8I_ADDA_ADC_AP_EN,
@@ -295,12 +286,8 @@ static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 	 * stream widgets at the card level.
 	 */
 
-	/* Line In */
-	SND_SOC_DAPM_INPUT("LINEIN"),
-
-	/* Microphone inputs */
+	/* Microphone input */
 	SND_SOC_DAPM_INPUT("MIC1"),
-	SND_SOC_DAPM_INPUT("MIC2"),
 
 	/* Microphone Bias */
 	SND_SOC_DAPM_SUPPLY("MBIAS", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
@@ -310,8 +297,6 @@ static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 	/* Mic input path */
 	SND_SOC_DAPM_PGA("Mic1 Amplifier", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
 			 SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MIC1AMPEN, 0, NULL, 0),
-	SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN8I_ADDA_MIC2G_CTRL,
-			 SUN8I_ADDA_MIC2G_CTRL_MIC2AMPEN, 0, NULL, 0),
 
 	/* Mixers */
 	SND_SOC_DAPM_MIXER("Left Mixer", SUN8I_ADDA_DAC_PA_SRC,
@@ -335,35 +320,26 @@ static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 static const struct snd_soc_dapm_route sun8i_codec_common_routes[] = {
 	/* Microphone Routes */
 	{ "Mic1 Amplifier", NULL, "MIC1"},
-	{ "Mic2 Amplifier", NULL, "MIC2"},
 
 	/* Left Mixer Routes */
 	{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
 	{ "Left Mixer", "DAC Reversed Playback Switch", "Right DAC" },
-	{ "Left Mixer", "Line In Playback Switch", "LINEIN" },
 	{ "Left Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
-	{ "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
 
 	/* Right Mixer Routes */
 	{ "Right Mixer", "DAC Playback Switch", "Right DAC" },
 	{ "Right Mixer", "DAC Reversed Playback Switch", "Left DAC" },
-	{ "Right Mixer", "Line In Playback Switch", "LINEIN" },
 	{ "Right Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
-	{ "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
 
 	/* Left ADC Mixer Routes */
 	{ "Left ADC Mixer", "Mixer Capture Switch", "Left Mixer" },
 	{ "Left ADC Mixer", "Mixer Reversed Capture Switch", "Right Mixer" },
-	{ "Left ADC Mixer", "Line In Capture Switch", "LINEIN" },
 	{ "Left ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" },
-	{ "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
 
 	/* Right ADC Mixer Routes */
 	{ "Right ADC Mixer", "Mixer Capture Switch", "Right Mixer" },
 	{ "Right ADC Mixer", "Mixer Reversed Capture Switch", "Left Mixer" },
-	{ "Right ADC Mixer", "Line In Capture Switch", "LINEIN" },
 	{ "Right ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" },
-	{ "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
 
 	/* ADC Routes */
 	{ "Left ADC", NULL, "Left ADC Mixer" },
@@ -498,6 +474,61 @@ static int sun8i_codec_add_hmic(struct snd_soc_component *cmpnt)
 	return ret;
 }
 
+/* line in specific controls, widgets and rines */
+static const struct snd_kcontrol_new sun8i_codec_linein_controls[] = {
+	/* Mixer pre-gain */
+	SOC_SINGLE_TLV("Line In Playback Volume", SUN8I_ADDA_LINEIN_GCTRL,
+		       SUN8I_ADDA_LINEIN_GCTRL_LINEING,
+		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
+};
+
+static const struct snd_soc_dapm_widget sun8i_codec_linein_widgets[] = {
+	/* Line input */
+	SND_SOC_DAPM_INPUT("LINEIN"),
+};
+
+static const struct snd_soc_dapm_route sun8i_codec_linein_routes[] = {
+	{ "Left Mixer", "Line In Playback Switch", "LINEIN" },
+
+	{ "Right Mixer", "Line In Playback Switch", "LINEIN" },
+
+	{ "Left ADC Mixer", "Line In Capture Switch", "LINEIN" },
+
+	{ "Right ADC Mixer", "Line In Capture Switch", "LINEIN" },
+};
+
+static int sun8i_codec_add_linein(struct snd_soc_component *cmpnt)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cmpnt);
+	struct device *dev = cmpnt->dev;
+	int ret;
+
+	ret = snd_soc_add_component_controls(cmpnt,
+					     sun8i_codec_linein_controls,
+					     ARRAY_SIZE(sun8i_codec_linein_controls));
+	if (ret) {
+		dev_err(dev, "Failed to add Line In controls: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_new_controls(dapm, sun8i_codec_linein_widgets,
+					ARRAY_SIZE(sun8i_codec_linein_widgets));
+	if (ret) {
+		dev_err(dev, "Failed to add Line In DAPM widgets: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(dapm, sun8i_codec_linein_routes,
+				      ARRAY_SIZE(sun8i_codec_linein_routes));
+	if (ret) {
+		dev_err(dev, "Failed to add Line In DAPM routes: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+
 /* line out specific controls, widgets and routes */
 static const DECLARE_TLV_DB_RANGE(sun8i_codec_lineout_vol_scale,
 	0, 1, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
@@ -578,19 +609,90 @@ static int sun8i_codec_add_lineout(struct snd_soc_component *cmpnt)
 	return 0;
 }
 
+/* mic2 specific controls, widgets and routes */
+static const struct snd_kcontrol_new sun8i_codec_mic2_controls[] = {
+	/* Mixer pre-gain */
+	SOC_SINGLE_TLV("Mic2 Playback Volume",
+		       SUN8I_ADDA_MICIN_GCTRL, SUN8I_ADDA_MICIN_GCTRL_MIC2G,
+		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
+
+	/* Microphone Amp boost gain */
+	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN8I_ADDA_MIC2G_CTRL,
+		       SUN8I_ADDA_MIC2G_CTRL_MIC2BOOST, 0x7, 0,
+		       sun8i_codec_mic_gain_scale),
+};
+
+static const struct snd_soc_dapm_widget sun8i_codec_mic2_widgets[] = {
+	/* Microphone input */
+	SND_SOC_DAPM_INPUT("MIC2"),
+
+	/* Mic input path */
+	SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN8I_ADDA_MIC2G_CTRL,
+			 SUN8I_ADDA_MIC2G_CTRL_MIC2AMPEN, 0, NULL, 0),
+};
+
+static const struct snd_soc_dapm_route sun8i_codec_mic2_routes[] = {
+	{ "Mic2 Amplifier", NULL, "MIC2"},
+
+	{ "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
+
+	{ "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
+
+	{ "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
+
+	{ "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
+};
+
+static int sun8i_codec_add_mic2(struct snd_soc_component *cmpnt)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cmpnt);
+	struct device *dev = cmpnt->dev;
+	int ret;
+
+	ret = snd_soc_add_component_controls(cmpnt,
+					     sun8i_codec_mic2_controls,
+					     ARRAY_SIZE(sun8i_codec_mic2_controls));
+	if (ret) {
+		dev_err(dev, "Failed to add MIC2 controls: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_new_controls(dapm, sun8i_codec_mic2_widgets,
+					ARRAY_SIZE(sun8i_codec_mic2_widgets));
+	if (ret) {
+		dev_err(dev, "Failed to add MIC2 DAPM widgets: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(dapm, sun8i_codec_mic2_routes,
+				      ARRAY_SIZE(sun8i_codec_mic2_routes));
+	if (ret) {
+		dev_err(dev, "Failed to add MIC2 DAPM routes: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 struct sun8i_codec_analog_quirks {
 	bool has_headphone;
 	bool has_hmic;
+	bool has_linein;
 	bool has_lineout;
+	bool has_mic2;
 };
 
 static const struct sun8i_codec_analog_quirks sun8i_a23_quirks = {
 	.has_headphone	= true,
 	.has_hmic	= true,
+	.has_linein	= true,
+	.has_mic2	= true,
 };
 
 static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
+	.has_linein	= true,
 	.has_lineout	= true,
+	.has_mic2	= true,
 };
 
 static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
@@ -620,12 +722,24 @@ static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
 			return ret;
 	}
 
+	if (quirks->has_linein) {
+		ret = sun8i_codec_add_linein(cmpnt);
+		if (ret)
+			return ret;
+	}
+
 	if (quirks->has_lineout) {
 		ret = sun8i_codec_add_lineout(cmpnt);
 		if (ret)
 			return ret;
 	}
 
+	if (quirks->has_mic2) {
+		ret = sun8i_codec_add_mic2(cmpnt);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 2/9] ASoC: sun8i-codec-analog: split out linein and mic2
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner V3s SoC features an analog codec without linein and mic2.

Split out them, in order to prepare for the analog codec on V3s.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 sound/soc/sunxi/sun8i-codec-analog.c | 168 +++++++++++++++++++++++++++++------
 1 file changed, 141 insertions(+), 27 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 72331332b72e..6c17c99c2c8d 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -252,24 +252,15 @@ static const DECLARE_TLV_DB_RANGE(sun8i_codec_mic_gain_scale,
 );
 
 static const struct snd_kcontrol_new sun8i_codec_common_controls[] = {
-	/* Mixer pre-gains */
-	SOC_SINGLE_TLV("Line In Playback Volume", SUN8I_ADDA_LINEIN_GCTRL,
-		       SUN8I_ADDA_LINEIN_GCTRL_LINEING,
-		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
+	/* Mixer pre-gain */
 	SOC_SINGLE_TLV("Mic1 Playback Volume", SUN8I_ADDA_MICIN_GCTRL,
 		       SUN8I_ADDA_MICIN_GCTRL_MIC1G,
 		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
-	SOC_SINGLE_TLV("Mic2 Playback Volume",
-		       SUN8I_ADDA_MICIN_GCTRL, SUN8I_ADDA_MICIN_GCTRL_MIC2G,
-		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
 
-	/* Microphone Amp boost gains */
+	/* Microphone Amp boost gain */
 	SOC_SINGLE_TLV("Mic1 Boost Volume", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
 		       SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MIC1BOOST, 0x7, 0,
 		       sun8i_codec_mic_gain_scale),
-	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN8I_ADDA_MIC2G_CTRL,
-		       SUN8I_ADDA_MIC2G_CTRL_MIC2BOOST, 0x7, 0,
-		       sun8i_codec_mic_gain_scale),
 
 	/* ADC */
 	SOC_SINGLE_TLV("ADC Gain Capture Volume", SUN8I_ADDA_ADC_AP_EN,
@@ -295,12 +286,8 @@ static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 	 * stream widgets at the card level.
 	 */
 
-	/* Line In */
-	SND_SOC_DAPM_INPUT("LINEIN"),
-
-	/* Microphone inputs */
+	/* Microphone input */
 	SND_SOC_DAPM_INPUT("MIC1"),
-	SND_SOC_DAPM_INPUT("MIC2"),
 
 	/* Microphone Bias */
 	SND_SOC_DAPM_SUPPLY("MBIAS", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
@@ -310,8 +297,6 @@ static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 	/* Mic input path */
 	SND_SOC_DAPM_PGA("Mic1 Amplifier", SUN8I_ADDA_MIC1G_MICBIAS_CTRL,
 			 SUN8I_ADDA_MIC1G_MICBIAS_CTRL_MIC1AMPEN, 0, NULL, 0),
-	SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN8I_ADDA_MIC2G_CTRL,
-			 SUN8I_ADDA_MIC2G_CTRL_MIC2AMPEN, 0, NULL, 0),
 
 	/* Mixers */
 	SND_SOC_DAPM_MIXER("Left Mixer", SUN8I_ADDA_DAC_PA_SRC,
@@ -335,35 +320,26 @@ static const struct snd_soc_dapm_widget sun8i_codec_common_widgets[] = {
 static const struct snd_soc_dapm_route sun8i_codec_common_routes[] = {
 	/* Microphone Routes */
 	{ "Mic1 Amplifier", NULL, "MIC1"},
-	{ "Mic2 Amplifier", NULL, "MIC2"},
 
 	/* Left Mixer Routes */
 	{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
 	{ "Left Mixer", "DAC Reversed Playback Switch", "Right DAC" },
-	{ "Left Mixer", "Line In Playback Switch", "LINEIN" },
 	{ "Left Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
-	{ "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
 
 	/* Right Mixer Routes */
 	{ "Right Mixer", "DAC Playback Switch", "Right DAC" },
 	{ "Right Mixer", "DAC Reversed Playback Switch", "Left DAC" },
-	{ "Right Mixer", "Line In Playback Switch", "LINEIN" },
 	{ "Right Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
-	{ "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
 
 	/* Left ADC Mixer Routes */
 	{ "Left ADC Mixer", "Mixer Capture Switch", "Left Mixer" },
 	{ "Left ADC Mixer", "Mixer Reversed Capture Switch", "Right Mixer" },
-	{ "Left ADC Mixer", "Line In Capture Switch", "LINEIN" },
 	{ "Left ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" },
-	{ "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
 
 	/* Right ADC Mixer Routes */
 	{ "Right ADC Mixer", "Mixer Capture Switch", "Right Mixer" },
 	{ "Right ADC Mixer", "Mixer Reversed Capture Switch", "Left Mixer" },
-	{ "Right ADC Mixer", "Line In Capture Switch", "LINEIN" },
 	{ "Right ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" },
-	{ "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
 
 	/* ADC Routes */
 	{ "Left ADC", NULL, "Left ADC Mixer" },
@@ -498,6 +474,61 @@ static int sun8i_codec_add_hmic(struct snd_soc_component *cmpnt)
 	return ret;
 }
 
+/* line in specific controls, widgets and rines */
+static const struct snd_kcontrol_new sun8i_codec_linein_controls[] = {
+	/* Mixer pre-gain */
+	SOC_SINGLE_TLV("Line In Playback Volume", SUN8I_ADDA_LINEIN_GCTRL,
+		       SUN8I_ADDA_LINEIN_GCTRL_LINEING,
+		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
+};
+
+static const struct snd_soc_dapm_widget sun8i_codec_linein_widgets[] = {
+	/* Line input */
+	SND_SOC_DAPM_INPUT("LINEIN"),
+};
+
+static const struct snd_soc_dapm_route sun8i_codec_linein_routes[] = {
+	{ "Left Mixer", "Line In Playback Switch", "LINEIN" },
+
+	{ "Right Mixer", "Line In Playback Switch", "LINEIN" },
+
+	{ "Left ADC Mixer", "Line In Capture Switch", "LINEIN" },
+
+	{ "Right ADC Mixer", "Line In Capture Switch", "LINEIN" },
+};
+
+static int sun8i_codec_add_linein(struct snd_soc_component *cmpnt)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cmpnt);
+	struct device *dev = cmpnt->dev;
+	int ret;
+
+	ret = snd_soc_add_component_controls(cmpnt,
+					     sun8i_codec_linein_controls,
+					     ARRAY_SIZE(sun8i_codec_linein_controls));
+	if (ret) {
+		dev_err(dev, "Failed to add Line In controls: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_new_controls(dapm, sun8i_codec_linein_widgets,
+					ARRAY_SIZE(sun8i_codec_linein_widgets));
+	if (ret) {
+		dev_err(dev, "Failed to add Line In DAPM widgets: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(dapm, sun8i_codec_linein_routes,
+				      ARRAY_SIZE(sun8i_codec_linein_routes));
+	if (ret) {
+		dev_err(dev, "Failed to add Line In DAPM routes: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+
 /* line out specific controls, widgets and routes */
 static const DECLARE_TLV_DB_RANGE(sun8i_codec_lineout_vol_scale,
 	0, 1, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
@@ -578,19 +609,90 @@ static int sun8i_codec_add_lineout(struct snd_soc_component *cmpnt)
 	return 0;
 }
 
+/* mic2 specific controls, widgets and routes */
+static const struct snd_kcontrol_new sun8i_codec_mic2_controls[] = {
+	/* Mixer pre-gain */
+	SOC_SINGLE_TLV("Mic2 Playback Volume",
+		       SUN8I_ADDA_MICIN_GCTRL, SUN8I_ADDA_MICIN_GCTRL_MIC2G,
+		       0x7, 0, sun8i_codec_out_mixer_pregain_scale),
+
+	/* Microphone Amp boost gain */
+	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN8I_ADDA_MIC2G_CTRL,
+		       SUN8I_ADDA_MIC2G_CTRL_MIC2BOOST, 0x7, 0,
+		       sun8i_codec_mic_gain_scale),
+};
+
+static const struct snd_soc_dapm_widget sun8i_codec_mic2_widgets[] = {
+	/* Microphone input */
+	SND_SOC_DAPM_INPUT("MIC2"),
+
+	/* Mic input path */
+	SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN8I_ADDA_MIC2G_CTRL,
+			 SUN8I_ADDA_MIC2G_CTRL_MIC2AMPEN, 0, NULL, 0),
+};
+
+static const struct snd_soc_dapm_route sun8i_codec_mic2_routes[] = {
+	{ "Mic2 Amplifier", NULL, "MIC2"},
+
+	{ "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
+
+	{ "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
+
+	{ "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
+
+	{ "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
+};
+
+static int sun8i_codec_add_mic2(struct snd_soc_component *cmpnt)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cmpnt);
+	struct device *dev = cmpnt->dev;
+	int ret;
+
+	ret = snd_soc_add_component_controls(cmpnt,
+					     sun8i_codec_mic2_controls,
+					     ARRAY_SIZE(sun8i_codec_mic2_controls));
+	if (ret) {
+		dev_err(dev, "Failed to add MIC2 controls: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_new_controls(dapm, sun8i_codec_mic2_widgets,
+					ARRAY_SIZE(sun8i_codec_mic2_widgets));
+	if (ret) {
+		dev_err(dev, "Failed to add MIC2 DAPM widgets: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(dapm, sun8i_codec_mic2_routes,
+				      ARRAY_SIZE(sun8i_codec_mic2_routes));
+	if (ret) {
+		dev_err(dev, "Failed to add MIC2 DAPM routes: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 struct sun8i_codec_analog_quirks {
 	bool has_headphone;
 	bool has_hmic;
+	bool has_linein;
 	bool has_lineout;
+	bool has_mic2;
 };
 
 static const struct sun8i_codec_analog_quirks sun8i_a23_quirks = {
 	.has_headphone	= true,
 	.has_hmic	= true,
+	.has_linein	= true,
+	.has_mic2	= true,
 };
 
 static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
+	.has_linein	= true,
 	.has_lineout	= true,
+	.has_mic2	= true,
 };
 
 static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
@@ -620,12 +722,24 @@ static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
 			return ret;
 	}
 
+	if (quirks->has_linein) {
+		ret = sun8i_codec_add_linein(cmpnt);
+		if (ret)
+			return ret;
+	}
+
 	if (quirks->has_lineout) {
 		ret = sun8i_codec_add_lineout(cmpnt);
 		if (ret)
 			return ret;
 	}
 
+	if (quirks->has_mic2) {
+		ret = sun8i_codec_add_mic2(cmpnt);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

The V3s SoC features an analog codec with headphone support but without
mic2 and linein.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
 sound/soc/sunxi/sun8i-codec-analog.c                           | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
index 779b735781ba..1b6e7c4e50ab 100644
--- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
+++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
@@ -4,6 +4,7 @@ Required properties:
 - compatible: must be one of the following compatibles:
 		- "allwinner,sun8i-a23-codec-analog"
 		- "allwinner,sun8i-h3-codec-analog"
+		- "allwinner,sun8i-v3s-codec-analog"
 
 Required properties if not a sub-node of the PRCM node:
 - reg: must contain the registers location and length
diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 6c17c99c2c8d..6375932177a3 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
 	.has_mic2	= true,
 };
 
+static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
+	.has_headphone	= true,
+	.has_hmic	= true,
+};
+
 static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
 {
 	struct device *dev = cmpnt->dev;
@@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
 		.compatible = "allwinner,sun8i-h3-codec-analog",
 		.data = &sun8i_h3_quirks,
 	},
+	{
+		.compatible = "allwinner,sun8i-v3s-codec-analog",
+		.data = &sun8i_v3s_quirks,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

The V3s SoC features an analog codec with headphone support but without
mic2 and linein.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
 sound/soc/sunxi/sun8i-codec-analog.c                           | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
index 779b735781ba..1b6e7c4e50ab 100644
--- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
+++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
@@ -4,6 +4,7 @@ Required properties:
 - compatible: must be one of the following compatibles:
 		- "allwinner,sun8i-a23-codec-analog"
 		- "allwinner,sun8i-h3-codec-analog"
+		- "allwinner,sun8i-v3s-codec-analog"
 
 Required properties if not a sub-node of the PRCM node:
 - reg: must contain the registers location and length
diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 6c17c99c2c8d..6375932177a3 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
 	.has_mic2	= true,
 };
 
+static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
+	.has_headphone	= true,
+	.has_hmic	= true,
+};
+
 static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
 {
 	struct device *dev = cmpnt->dev;
@@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
 		.compatible = "allwinner,sun8i-h3-codec-analog",
 		.data = &sun8i_h3_quirks,
 	},
+	{
+		.compatible = "allwinner,sun8i-v3s-codec-analog",
+		.data = &sun8i_v3s_quirks,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 4/9] ASoC: sun4i-codec: Add support for V3s codec
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

The codec in the V3s is similar to the one found on the A31. One key
difference is the analog path controls are routed through the PRCM
block. This is supported by the sun8i-codec-analog driver, and tied
into this codec driver with the audio card's aux_dev.

In addition, the V3s does not have LINEIN, LINEOUT and MIC2, MIC3, and
the FIFO related registers are like H3.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 .../devicetree/bindings/sound/sun4i-codec.txt      |  9 ++--
 sound/soc/sunxi/sun4i-codec.c                      | 59 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
index 3863531d1e6d..3ebbcd7133b3 100644
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
@@ -7,6 +7,7 @@ Required properties:
 		- "allwinner,sun7i-a20-codec"
 		- "allwinner,sun8i-a23-codec"
 		- "allwinner,sun8i-h3-codec"
+		- "allwinner,sun8i-v3s-codec"
 - reg: must contain the registers location and length
 - interrupts: must contain the codec interrupt
 - dmas: DMA channels for tx and rx dma. See the DMA client binding,
@@ -25,6 +26,7 @@ Required properties for the following compatibles:
 		- "allwinner,sun6i-a31-codec"
 		- "allwinner,sun8i-a23-codec"
 		- "allwinner,sun8i-h3-codec"
+		- "allwinner,sun8i-v3s-codec"
 - resets: phandle to the reset control for this device
 - allwinner,audio-routing: A list of the connections between audio components.
 			   Each entry is a pair of strings, the first being the
@@ -34,10 +36,10 @@ Required properties for the following compatibles:
 			   Audio pins on the SoC:
 			   "HP"
 			   "HPCOM"
-			   "LINEIN"
-			   "LINEOUT"	(not on sun8i-a23)
+			   "LINEIN"	(not on sun8i-v3s)
+			   "LINEOUT"	(not on sun8i-a23 or sun8i-v3s)
 			   "MIC1"
-			   "MIC2"
+			   "MIC2"	(not on sun8i-v3s)
 			   "MIC3"	(sun6i-a31 only)
 
 			   Microphone biases from the SoC:
@@ -55,6 +57,7 @@ Required properties for the following compatibles:
 Required properties for the following compatibles:
 		- "allwinner,sun8i-a23-codec"
 		- "allwinner,sun8i-h3-codec"
+		- "allwinner,sun8i-v3s-codec"
 - allwinner,codec-analog-controls: A phandle to the codec analog controls
 				   block in the PRCM.
 
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index c3aab10fa085..7f1b1aa95e0b 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1339,6 +1339,44 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev)
 	return card;
 };
 
+static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev)
+{
+	struct snd_soc_card *card;
+	int ret;
+
+	card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
+	if (!card)
+		return ERR_PTR(-ENOMEM);
+
+	aux_dev.codec_of_node = of_parse_phandle(dev->of_node,
+						 "allwinner,codec-analog-controls",
+						 0);
+	if (!aux_dev.codec_of_node) {
+		dev_err(dev, "Can't find analog controls for codec.\n");
+		return ERR_PTR(-EINVAL);
+	};
+
+	card->dai_link = sun4i_codec_create_link(dev, &card->num_links);
+	if (!card->dai_link)
+		return ERR_PTR(-ENOMEM);
+
+	card->dev		= dev;
+	card->name		= "V3s Audio Codec";
+	card->dapm_widgets	= sun6i_codec_card_dapm_widgets;
+	card->num_dapm_widgets	= ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
+	card->dapm_routes	= sun8i_codec_card_routes;
+	card->num_dapm_routes	= ARRAY_SIZE(sun8i_codec_card_routes);
+	card->aux_dev		= &aux_dev;
+	card->num_aux_devs	= 1;
+	card->fully_routed	= true;
+
+	ret = snd_soc_of_parse_audio_routing(card, "allwinner,audio-routing");
+	if (ret)
+		dev_warn(dev, "failed to parse audio-routing: %d\n", ret);
+
+	return card;
+};
+
 static const struct regmap_config sun4i_codec_regmap_config = {
 	.reg_bits	= 32,
 	.reg_stride	= 4,
@@ -1374,6 +1412,13 @@ static const struct regmap_config sun8i_h3_codec_regmap_config = {
 	.max_register	= SUN8I_H3_CODEC_ADC_DBG,
 };
 
+static const struct regmap_config sun8i_v3s_codec_regmap_config = {
+	.reg_bits	= 32,
+	.reg_stride	= 4,
+	.val_bits	= 32,
+	.max_register	= SUN6I_CODEC_HMIC_DATA,
+};
+
 struct sun4i_codec_quirks {
 	const struct regmap_config *regmap_config;
 	const struct snd_soc_codec_driver *codec;
@@ -1422,6 +1467,16 @@ static const struct sun4i_codec_quirks sun8i_a23_codec_quirks = {
 	.has_reset	= true,
 };
 
+static const struct sun4i_codec_quirks sun8i_v3s_codec_quirks = {
+	.regmap_config	= &sun8i_v3s_codec_regmap_config,
+	.codec		= &sun8i_a23_codec_codec,
+	.create_card	= sun8i_v3s_codec_create_card,
+	.reg_adc_fifoc	= REG_FIELD(SUN6I_CODEC_ADC_FIFOC, 0, 31),
+	.reg_dac_txdata	= SUN8I_H3_CODEC_DAC_TXDATA,
+	.reg_adc_rxdata	= SUN6I_CODEC_ADC_RXDATA,
+	.has_reset	= true,
+};
+
 static const struct sun4i_codec_quirks sun8i_h3_codec_quirks = {
 	.regmap_config	= &sun8i_h3_codec_regmap_config,
 	/*
@@ -1458,6 +1513,10 @@ static const struct of_device_id sun4i_codec_of_match[] = {
 		.compatible = "allwinner,sun8i-h3-codec",
 		.data = &sun8i_h3_codec_quirks,
 	},
+	{
+		.compatible = "allwinner,sun8i-v3s-codec",
+		.data = &sun8i_v3s_codec_quirks,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 4/9] ASoC: sun4i-codec: Add support for V3s codec
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

The codec in the V3s is similar to the one found on the A31. One key
difference is the analog path controls are routed through the PRCM
block. This is supported by the sun8i-codec-analog driver, and tied
into this codec driver with the audio card's aux_dev.

In addition, the V3s does not have LINEIN, LINEOUT and MIC2, MIC3, and
the FIFO related registers are like H3.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 .../devicetree/bindings/sound/sun4i-codec.txt      |  9 ++--
 sound/soc/sunxi/sun4i-codec.c                      | 59 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
index 3863531d1e6d..3ebbcd7133b3 100644
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
@@ -7,6 +7,7 @@ Required properties:
 		- "allwinner,sun7i-a20-codec"
 		- "allwinner,sun8i-a23-codec"
 		- "allwinner,sun8i-h3-codec"
+		- "allwinner,sun8i-v3s-codec"
 - reg: must contain the registers location and length
 - interrupts: must contain the codec interrupt
 - dmas: DMA channels for tx and rx dma. See the DMA client binding,
@@ -25,6 +26,7 @@ Required properties for the following compatibles:
 		- "allwinner,sun6i-a31-codec"
 		- "allwinner,sun8i-a23-codec"
 		- "allwinner,sun8i-h3-codec"
+		- "allwinner,sun8i-v3s-codec"
 - resets: phandle to the reset control for this device
 - allwinner,audio-routing: A list of the connections between audio components.
 			   Each entry is a pair of strings, the first being the
@@ -34,10 +36,10 @@ Required properties for the following compatibles:
 			   Audio pins on the SoC:
 			   "HP"
 			   "HPCOM"
-			   "LINEIN"
-			   "LINEOUT"	(not on sun8i-a23)
+			   "LINEIN"	(not on sun8i-v3s)
+			   "LINEOUT"	(not on sun8i-a23 or sun8i-v3s)
 			   "MIC1"
-			   "MIC2"
+			   "MIC2"	(not on sun8i-v3s)
 			   "MIC3"	(sun6i-a31 only)
 
 			   Microphone biases from the SoC:
@@ -55,6 +57,7 @@ Required properties for the following compatibles:
 Required properties for the following compatibles:
 		- "allwinner,sun8i-a23-codec"
 		- "allwinner,sun8i-h3-codec"
+		- "allwinner,sun8i-v3s-codec"
 - allwinner,codec-analog-controls: A phandle to the codec analog controls
 				   block in the PRCM.
 
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index c3aab10fa085..7f1b1aa95e0b 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1339,6 +1339,44 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev)
 	return card;
 };
 
+static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev)
+{
+	struct snd_soc_card *card;
+	int ret;
+
+	card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
+	if (!card)
+		return ERR_PTR(-ENOMEM);
+
+	aux_dev.codec_of_node = of_parse_phandle(dev->of_node,
+						 "allwinner,codec-analog-controls",
+						 0);
+	if (!aux_dev.codec_of_node) {
+		dev_err(dev, "Can't find analog controls for codec.\n");
+		return ERR_PTR(-EINVAL);
+	};
+
+	card->dai_link = sun4i_codec_create_link(dev, &card->num_links);
+	if (!card->dai_link)
+		return ERR_PTR(-ENOMEM);
+
+	card->dev		= dev;
+	card->name		= "V3s Audio Codec";
+	card->dapm_widgets	= sun6i_codec_card_dapm_widgets;
+	card->num_dapm_widgets	= ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
+	card->dapm_routes	= sun8i_codec_card_routes;
+	card->num_dapm_routes	= ARRAY_SIZE(sun8i_codec_card_routes);
+	card->aux_dev		= &aux_dev;
+	card->num_aux_devs	= 1;
+	card->fully_routed	= true;
+
+	ret = snd_soc_of_parse_audio_routing(card, "allwinner,audio-routing");
+	if (ret)
+		dev_warn(dev, "failed to parse audio-routing: %d\n", ret);
+
+	return card;
+};
+
 static const struct regmap_config sun4i_codec_regmap_config = {
 	.reg_bits	= 32,
 	.reg_stride	= 4,
@@ -1374,6 +1412,13 @@ static const struct regmap_config sun8i_h3_codec_regmap_config = {
 	.max_register	= SUN8I_H3_CODEC_ADC_DBG,
 };
 
+static const struct regmap_config sun8i_v3s_codec_regmap_config = {
+	.reg_bits	= 32,
+	.reg_stride	= 4,
+	.val_bits	= 32,
+	.max_register	= SUN6I_CODEC_HMIC_DATA,
+};
+
 struct sun4i_codec_quirks {
 	const struct regmap_config *regmap_config;
 	const struct snd_soc_codec_driver *codec;
@@ -1422,6 +1467,16 @@ static const struct sun4i_codec_quirks sun8i_a23_codec_quirks = {
 	.has_reset	= true,
 };
 
+static const struct sun4i_codec_quirks sun8i_v3s_codec_quirks = {
+	.regmap_config	= &sun8i_v3s_codec_regmap_config,
+	.codec		= &sun8i_a23_codec_codec,
+	.create_card	= sun8i_v3s_codec_create_card,
+	.reg_adc_fifoc	= REG_FIELD(SUN6I_CODEC_ADC_FIFOC, 0, 31),
+	.reg_dac_txdata	= SUN8I_H3_CODEC_DAC_TXDATA,
+	.reg_adc_rxdata	= SUN6I_CODEC_ADC_RXDATA,
+	.has_reset	= true,
+};
+
 static const struct sun4i_codec_quirks sun8i_h3_codec_quirks = {
 	.regmap_config	= &sun8i_h3_codec_regmap_config,
 	/*
@@ -1458,6 +1513,10 @@ static const struct of_device_id sun4i_codec_of_match[] = {
 		.compatible = "allwinner,sun8i-h3-codec",
 		.data = &sun8i_h3_codec_quirks,
 	},
+	{
+		.compatible = "allwinner,sun8i-v3s-codec",
+		.data = &sun8i_v3s_codec_quirks,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

Allwinner V3s has a DMA engine similar to the ones from A31, but with
fewer channels and DRQs.

Add support for it.

As it also needs the special gate bit, make the gate bit generic.

According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
have also been specified gate_needed property.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 Documentation/devicetree/bindings/dma/sun6i-dma.txt |  1 +
 drivers/dma/sun6i-dma.c                             | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
index 6b267045f522..98fbe1a5c6dd 100644
--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
@@ -9,6 +9,7 @@ Required properties:
 		  "allwinner,sun8i-a23-dma"
 		  "allwinner,sun8i-a83t-dma"
 		  "allwinner,sun8i-h3-dma"
+		  "allwinner,sun8i-v3s-dma"
 - reg:		Should contain the registers base address and length
 - interrupts:	Should contain a reference to the interrupt used by this device
 - clocks:	Should contain a reference to the parent AHB clock
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index a2358780ab2c..1f38424c1b14 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -101,6 +101,7 @@ struct sun6i_dma_config {
 	u32 nr_max_channels;
 	u32 nr_max_requests;
 	u32 nr_max_vchans;
+	bool gate_needed;
 };
 
 /*
@@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 24,
 	.nr_max_vchans   = 37,
+	.gate_needed	 = true,
 };
 
 static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 28,
 	.nr_max_vchans   = 39,
+	.gate_needed	 = true,
 };
 
 /*
@@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
 	.nr_max_vchans   = 34,
 };
 
+static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
+	.nr_max_channels = 8,
+	.nr_max_requests = 23,
+	.nr_max_vchans   = 24,
+	.gate_needed	 = true,
+};
+
 static const struct of_device_id sun6i_dma_match[] = {
 	{ .compatible = "allwinner,sun6i-a31-dma", .data = &sun6i_a31_dma_cfg },
 	{ .compatible = "allwinner,sun8i-a23-dma", .data = &sun8i_a23_dma_cfg },
 	{ .compatible = "allwinner,sun8i-a83t-dma", .data = &sun8i_a83t_dma_cfg },
 	{ .compatible = "allwinner,sun8i-h3-dma", .data = &sun8i_h3_dma_cfg },
+	{ .compatible = "allwinner,sun8i-v3s-dma", .data = &sun8i_v3s_dma_cfg },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, sun6i_dma_match);
@@ -1177,10 +1188,10 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	/*
 	 * sun8i variant requires us to toggle a dma gating register,
 	 * as seen in Allwinner's SDK. This register is not documented
-	 * in the A23 user manual.
+	 * in the A23 user manual, but documented at least in V3s user
+	 * manual.
 	 */
-	if (of_device_is_compatible(pdev->dev.of_node,
-				    "allwinner,sun8i-a23-dma"))
+	if (sdc->cfg->gate_needed)
 		writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE);
 
 	return 0;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner V3s has a DMA engine similar to the ones from A31, but with
fewer channels and DRQs.

Add support for it.

As it also needs the special gate bit, make the gate bit generic.

According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
have also been specified gate_needed property.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 Documentation/devicetree/bindings/dma/sun6i-dma.txt |  1 +
 drivers/dma/sun6i-dma.c                             | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
index 6b267045f522..98fbe1a5c6dd 100644
--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
@@ -9,6 +9,7 @@ Required properties:
 		  "allwinner,sun8i-a23-dma"
 		  "allwinner,sun8i-a83t-dma"
 		  "allwinner,sun8i-h3-dma"
+		  "allwinner,sun8i-v3s-dma"
 - reg:		Should contain the registers base address and length
 - interrupts:	Should contain a reference to the interrupt used by this device
 - clocks:	Should contain a reference to the parent AHB clock
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index a2358780ab2c..1f38424c1b14 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -101,6 +101,7 @@ struct sun6i_dma_config {
 	u32 nr_max_channels;
 	u32 nr_max_requests;
 	u32 nr_max_vchans;
+	bool gate_needed;
 };
 
 /*
@@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 24,
 	.nr_max_vchans   = 37,
+	.gate_needed	 = true,
 };
 
 static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
 	.nr_max_channels = 8,
 	.nr_max_requests = 28,
 	.nr_max_vchans   = 39,
+	.gate_needed	 = true,
 };
 
 /*
@@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
 	.nr_max_vchans   = 34,
 };
 
+static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
+	.nr_max_channels = 8,
+	.nr_max_requests = 23,
+	.nr_max_vchans   = 24,
+	.gate_needed	 = true,
+};
+
 static const struct of_device_id sun6i_dma_match[] = {
 	{ .compatible = "allwinner,sun6i-a31-dma", .data = &sun6i_a31_dma_cfg },
 	{ .compatible = "allwinner,sun8i-a23-dma", .data = &sun8i_a23_dma_cfg },
 	{ .compatible = "allwinner,sun8i-a83t-dma", .data = &sun8i_a83t_dma_cfg },
 	{ .compatible = "allwinner,sun8i-h3-dma", .data = &sun8i_h3_dma_cfg },
+	{ .compatible = "allwinner,sun8i-v3s-dma", .data = &sun8i_v3s_dma_cfg },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, sun6i_dma_match);
@@ -1177,10 +1188,10 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	/*
 	 * sun8i variant requires us to toggle a dma gating register,
 	 * as seen in Allwinner's SDK. This register is not documented
-	 * in the A23 user manual.
+	 * in the A23 user manual, but documented at least in V3s user
+	 * manual.
 	 */
-	if (of_device_is_compatible(pdev->dev.of_node,
-				    "allwinner,sun8i-a23-dma"))
+	if (sdc->cfg->gate_needed)
 		writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE);
 
 	return 0;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 6/9] ARM: dts: sun8i: restore the inclusion of ccu headers in V3s DTSI
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

When the V3s support patchset is applied, CCU headers and V3s DTSI went
into different trees, so the CCU inclusion is removed in the DTSI.

Add back them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 67 ++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 71075969e5e6..b3f8b7f9c0bb 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -40,6 +40,8 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <dt-bindings/clock/sun8i-v3s-ccu.h>
+#include <dt-bindings/reset/sun8i-v3s-ccu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 / {
@@ -55,7 +57,7 @@
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <0>;
-			clocks = <&ccu 14>;
+			clocks = <&ccu CLK_CPU>;
 		};
 	};
 
@@ -96,15 +98,15 @@
 		mmc0: mmc@01c0f000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c0f000 0x1000>;
-			clocks = <&ccu 22>,
-				 <&ccu 45>,
-				 <&ccu 47>,
-				 <&ccu 46>;
+			clocks = <&ccu CLK_BUS_MMC0>,
+				 <&ccu CLK_MMC0>,
+				 <&ccu CLK_MMC0_OUTPUT>,
+				 <&ccu CLK_MMC0_SAMPLE>;
 			clock-names = "ahb",
 				      "mmc",
 				      "output",
 				      "sample";
-			resets = <&ccu 7>;
+			resets = <&ccu RST_BUS_MMC0>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
@@ -115,15 +117,15 @@
 		mmc1: mmc@01c10000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c10000 0x1000>;
-			clocks = <&ccu 23>,
-				 <&ccu 48>,
-				 <&ccu 50>,
-				 <&ccu 49>;
+			clocks = <&ccu CLK_BUS_MMC1>,
+				 <&ccu CLK_MMC1>,
+				 <&ccu CLK_MMC1_OUTPUT>,
+				 <&ccu CLK_MMC1_SAMPLE>;
 			clock-names = "ahb",
 				      "mmc",
 				      "output",
 				      "sample";
-			resets = <&ccu 8>;
+			resets = <&ccu RST_BUS_MMC1>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
@@ -134,15 +136,15 @@
 		mmc2: mmc@01c11000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c11000 0x1000>;
-			clocks = <&ccu 24>,
-				 <&ccu 51>,
-				 <&ccu 53>,
-				 <&ccu 52>;
+			clocks = <&ccu CLK_BUS_MMC2>,
+				 <&ccu CLK_MMC2>,
+				 <&ccu CLK_MMC2_OUTPUT>,
+				 <&ccu CLK_MMC2_SAMPLE>;
 			clock-names = "ahb",
 				      "mmc",
 				      "output",
 				      "sample";
-			resets = <&ccu 9>;
+			resets = <&ccu RST_BUS_MMC2>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
@@ -153,8 +155,8 @@
 		usb_otg: usb@01c19000 {
 			compatible = "allwinner,sun8i-h3-musb";
 			reg = <0x01c19000 0x0400>;
-			clocks = <&ccu 29>;
-			resets = <&ccu 17>;
+			clocks = <&ccu CLK_BUS_OTG>;
+			resets = <&ccu RST_BUS_OTG>;
 			interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "mc";
 			phys = <&usbphy 0>;
@@ -169,9 +171,9 @@
 			      <0x01c1a800 0x4>;
 			reg-names = "phy_ctrl",
 				    "pmu0";
-			clocks = <&ccu 56>;
+			clocks = <&ccu CLK_USB_PHY0>;
 			clock-names = "usb0_phy";
-			resets = <&ccu 0>;
+			resets = <&ccu RST_USB_PHY0>;
 			reset-names = "usb0_reset";
 			status = "disabled";
 			#phy-cells = <1>;
@@ -198,7 +200,7 @@
 			reg = <0x01c20800 0x400>;
 			interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu 37>, <&osc24M>, <&osc32k>;
+			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
 			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			#gpio-cells = <3>;
@@ -213,6 +215,7 @@
 			uart0_pins_a: uart0@0 {
 				pins = "PB8", "PB9";
 				function = "uart0";
+				bias-pull-up;
 			};
 
 			mmc0_pins_a: mmc0@0 {
@@ -244,8 +247,8 @@
 			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 40>;
-			resets = <&ccu 49>;
+			clocks = <&ccu CLK_BUS_UART0>;
+			resets = <&ccu RST_BUS_UART0>;
 			status = "disabled";
 		};
 
@@ -255,8 +258,8 @@
 			interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 41>;
-			resets = <&ccu 50>;
+			clocks = <&ccu CLK_BUS_UART1>;
+			resets = <&ccu RST_BUS_UART1>;
 			status = "disabled";
 		};
 
@@ -266,8 +269,8 @@
 			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 42>;
-			resets = <&ccu 51>;
+			clocks = <&ccu CLK_BUS_UART2>;
+			resets = <&ccu RST_BUS_UART2>;
 			status = "disabled";
 		};
 
@@ -275,10 +278,8 @@
 			compatible = "allwinner,sun6i-a31-i2c";
 			reg = <0x01c2ac00 0x400>;
 			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu 38>;
-			resets = <&ccu 46>;
-			pinctrl-names = "default";
-			pinctrl-0 = <&i2c0_pins>;
+			clocks = <&ccu CLK_BUS_I2C0>;
+			resets = <&ccu RST_BUS_I2C0>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -288,8 +289,8 @@
 			compatible = "allwinner,sun6i-a31-i2c";
 			reg = <0x01c2b000 0x400>;
 			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu 39>;
-			resets = <&ccu 47>;
+			clocks = <&ccu CLK_BUS_I2C1>;
+			resets = <&ccu RST_BUS_I2C1>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 6/9] ARM: dts: sun8i: restore the inclusion of ccu headers in V3s DTSI
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

When the V3s support patchset is applied, CCU headers and V3s DTSI went
into different trees, so the CCU inclusion is removed in the DTSI.

Add back them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 67 ++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 71075969e5e6..b3f8b7f9c0bb 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -40,6 +40,8 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <dt-bindings/clock/sun8i-v3s-ccu.h>
+#include <dt-bindings/reset/sun8i-v3s-ccu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 / {
@@ -55,7 +57,7 @@
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <0>;
-			clocks = <&ccu 14>;
+			clocks = <&ccu CLK_CPU>;
 		};
 	};
 
@@ -96,15 +98,15 @@
 		mmc0: mmc at 01c0f000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c0f000 0x1000>;
-			clocks = <&ccu 22>,
-				 <&ccu 45>,
-				 <&ccu 47>,
-				 <&ccu 46>;
+			clocks = <&ccu CLK_BUS_MMC0>,
+				 <&ccu CLK_MMC0>,
+				 <&ccu CLK_MMC0_OUTPUT>,
+				 <&ccu CLK_MMC0_SAMPLE>;
 			clock-names = "ahb",
 				      "mmc",
 				      "output",
 				      "sample";
-			resets = <&ccu 7>;
+			resets = <&ccu RST_BUS_MMC0>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
@@ -115,15 +117,15 @@
 		mmc1: mmc at 01c10000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c10000 0x1000>;
-			clocks = <&ccu 23>,
-				 <&ccu 48>,
-				 <&ccu 50>,
-				 <&ccu 49>;
+			clocks = <&ccu CLK_BUS_MMC1>,
+				 <&ccu CLK_MMC1>,
+				 <&ccu CLK_MMC1_OUTPUT>,
+				 <&ccu CLK_MMC1_SAMPLE>;
 			clock-names = "ahb",
 				      "mmc",
 				      "output",
 				      "sample";
-			resets = <&ccu 8>;
+			resets = <&ccu RST_BUS_MMC1>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
@@ -134,15 +136,15 @@
 		mmc2: mmc at 01c11000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c11000 0x1000>;
-			clocks = <&ccu 24>,
-				 <&ccu 51>,
-				 <&ccu 53>,
-				 <&ccu 52>;
+			clocks = <&ccu CLK_BUS_MMC2>,
+				 <&ccu CLK_MMC2>,
+				 <&ccu CLK_MMC2_OUTPUT>,
+				 <&ccu CLK_MMC2_SAMPLE>;
 			clock-names = "ahb",
 				      "mmc",
 				      "output",
 				      "sample";
-			resets = <&ccu 9>;
+			resets = <&ccu RST_BUS_MMC2>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
@@ -153,8 +155,8 @@
 		usb_otg: usb at 01c19000 {
 			compatible = "allwinner,sun8i-h3-musb";
 			reg = <0x01c19000 0x0400>;
-			clocks = <&ccu 29>;
-			resets = <&ccu 17>;
+			clocks = <&ccu CLK_BUS_OTG>;
+			resets = <&ccu RST_BUS_OTG>;
 			interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
 			interrupt-names = "mc";
 			phys = <&usbphy 0>;
@@ -169,9 +171,9 @@
 			      <0x01c1a800 0x4>;
 			reg-names = "phy_ctrl",
 				    "pmu0";
-			clocks = <&ccu 56>;
+			clocks = <&ccu CLK_USB_PHY0>;
 			clock-names = "usb0_phy";
-			resets = <&ccu 0>;
+			resets = <&ccu RST_USB_PHY0>;
 			reset-names = "usb0_reset";
 			status = "disabled";
 			#phy-cells = <1>;
@@ -198,7 +200,7 @@
 			reg = <0x01c20800 0x400>;
 			interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu 37>, <&osc24M>, <&osc32k>;
+			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
 			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			#gpio-cells = <3>;
@@ -213,6 +215,7 @@
 			uart0_pins_a: uart0 at 0 {
 				pins = "PB8", "PB9";
 				function = "uart0";
+				bias-pull-up;
 			};
 
 			mmc0_pins_a: mmc0 at 0 {
@@ -244,8 +247,8 @@
 			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 40>;
-			resets = <&ccu 49>;
+			clocks = <&ccu CLK_BUS_UART0>;
+			resets = <&ccu RST_BUS_UART0>;
 			status = "disabled";
 		};
 
@@ -255,8 +258,8 @@
 			interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 41>;
-			resets = <&ccu 50>;
+			clocks = <&ccu CLK_BUS_UART1>;
+			resets = <&ccu RST_BUS_UART1>;
 			status = "disabled";
 		};
 
@@ -266,8 +269,8 @@
 			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 42>;
-			resets = <&ccu 51>;
+			clocks = <&ccu CLK_BUS_UART2>;
+			resets = <&ccu RST_BUS_UART2>;
 			status = "disabled";
 		};
 
@@ -275,10 +278,8 @@
 			compatible = "allwinner,sun6i-a31-i2c";
 			reg = <0x01c2ac00 0x400>;
 			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu 38>;
-			resets = <&ccu 46>;
-			pinctrl-names = "default";
-			pinctrl-0 = <&i2c0_pins>;
+			clocks = <&ccu CLK_BUS_I2C0>;
+			resets = <&ccu RST_BUS_I2C0>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -288,8 +289,8 @@
 			compatible = "allwinner,sun6i-a31-i2c";
 			reg = <0x01c2b000 0x400>;
 			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu 39>;
-			resets = <&ccu 47>;
+			clocks = <&ccu CLK_BUS_I2C1>;
+			resets = <&ccu RST_BUS_I2C1>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 7/9] ARM: dts: sun8i: add DMA engine in V3s DTSI
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

Allwinner V3s SoC features a DMA engine.

Add it in the DTSI file.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index b3f8b7f9c0bb..7e0342976ba8 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -95,6 +95,15 @@
 		#size-cells = <1>;
 		ranges;
 
+		dma: dma-controller@01c02000 {
+			compatible = "allwinner,sun8i-v3s-dma";
+			reg = <0x01c02000 0x1000>;
+			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_DMA>;
+			resets = <&ccu RST_BUS_DMA>;
+			#dma-cells = <1>;
+		};
+
 		mmc0: mmc@01c0f000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c0f000 0x1000>;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 7/9] ARM: dts: sun8i: add DMA engine in V3s DTSI
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner V3s SoC features a DMA engine.

Add it in the DTSI file.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index b3f8b7f9c0bb..7e0342976ba8 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -95,6 +95,15 @@
 		#size-cells = <1>;
 		ranges;
 
+		dma: dma-controller at 01c02000 {
+			compatible = "allwinner,sun8i-v3s-dma";
+			reg = <0x01c02000 0x1000>;
+			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_DMA>;
+			resets = <&ccu RST_BUS_DMA>;
+			#dma-cells = <1>;
+		};
+
 		mmc0: mmc at 01c0f000 {
 			compatible = "allwinner,sun7i-a20-mmc";
 			reg = <0x01c0f000 0x1000>;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 8/9] ARM: dts: sun8i: add audio codec support into V3s DTSI
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

Allwinner V3s SoC features an internal audio codec like the one in H3,
and a analog codec like the one in H3/A23 (but much simpler).

Add them in the DTSI file.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 7e0342976ba8..5fb6cb69f7bc 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -250,6 +250,25 @@
 			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		codec: codec@01c22c00 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun8i-v3s-codec";
+			reg = <0x01c22c00 0x400>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
+			clock-names = "apb", "codec";
+			resets = <&ccu RST_BUS_CODEC>;
+			dmas = <&dma 15>, <&dma 15>;
+			dma-names = "rx", "tx";
+			allwinner,codec-analog-controls = <&codec_analog>;
+			status = "disabled";
+		};
+
+		codec_analog: codec-analog@01c23000 {
+			compatible = "allwinner,sun8i-v3s-codec-analog";
+			reg = <0x01c23000 0x4>;
+		};
+
 		uart0: serial@01c28000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c28000 0x400>;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 8/9] ARM: dts: sun8i: add audio codec support into V3s DTSI
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

Allwinner V3s SoC features an internal audio codec like the one in H3,
and a analog codec like the one in H3/A23 (but much simpler).

Add them in the DTSI file.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 7e0342976ba8..5fb6cb69f7bc 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -250,6 +250,25 @@
 			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		codec: codec at 01c22c00 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun8i-v3s-codec";
+			reg = <0x01c22c00 0x400>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
+			clock-names = "apb", "codec";
+			resets = <&ccu RST_BUS_CODEC>;
+			dmas = <&dma 15>, <&dma 15>;
+			dma-names = "rx", "tx";
+			allwinner,codec-analog-controls = <&codec_analog>;
+			status = "disabled";
+		};
+
+		codec_analog: codec-analog at 01c23000 {
+			compatible = "allwinner,sun8i-v3s-codec-analog";
+			reg = <0x01c23000 0x4>;
+		};
+
 		uart0: serial at 01c28000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c28000 0x400>;
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 9/9] ARM: dts: sun8i: enable audio on Lichee Pi Zero Dock
  2017-02-25 12:30 ` Icenowy Zheng
@ 2017-02-25 12:30   ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown
  Cc: devicetree, alsa-devel, linux-kernel, Icenowy Zheng, dmaengine,
	linux-arm-kernel

The Dock board of Lichee Pi Zero features a 3.5mm Headphone Jack and an
onboard MIC.

Add support for them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
index 68c114d6b939..d0f17bcaeaab 100644
--- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
+++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
@@ -47,3 +47,12 @@
 	compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
 		     "allwinner,sun8i-v3s";
 };
+
+&codec {
+	allwinner,audio-routing =
+		"Headphone", "HP",
+		"Headphone", "HPCOM",
+		"MIC1", "Mic",
+		"Mic",  "MBIAS";
+	status = "okay";
+};
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 9/9] ARM: dts: sun8i: enable audio on Lichee Pi Zero Dock
@ 2017-02-25 12:30   ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-25 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

The Dock board of Lichee Pi Zero features a 3.5mm Headphone Jack and an
onboard MIC.

Add support for them.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
index 68c114d6b939..d0f17bcaeaab 100644
--- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
+++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
@@ -47,3 +47,12 @@
 	compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
 		     "allwinner,sun8i-v3s";
 };
+
+&codec {
+	allwinner,audio-routing =
+		"Headphone", "HP",
+		"Headphone", "HPCOM",
+		"MIC1", "Mic",
+		"Mic",  "MBIAS";
+	status = "okay";
+};
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH 2/9] ASoC: sun8i-codec-analog: split out linein and mic2
  2017-02-25 12:30   ` Icenowy Zheng
  (?)
@ 2017-02-26  6:06     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 45+ messages in thread
From: Chen-Yu Tsai @ 2017-02-26  6:06 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown,
	dmaengine, devicetree, linux-arm-kernel, linux-kernel,
	Linux-ALSA

On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Allwinner V3s SoC features an analog codec without linein and mic2.
>
> Split out them, in order to prepare for the analog codec on V3s.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>

Acked-by: Chen-Yu Tsai <wens@csie.org>

Though it would be better if you did 1 split as 1 patch, with 2 patches
in total.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 2/9] ASoC: sun8i-codec-analog: split out linein and mic2
@ 2017-02-26  6:06     ` Chen-Yu Tsai
  0 siblings, 0 replies; 45+ messages in thread
From: Chen-Yu Tsai @ 2017-02-26  6:06 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, Linux-ALSA, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, Maxime Ripard,
	linux-arm-kernel

On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Allwinner V3s SoC features an analog codec without linein and mic2.
>
> Split out them, in order to prepare for the analog codec on V3s.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>

Acked-by: Chen-Yu Tsai <wens@csie.org>

Though it would be better if you did 1 split as 1 patch, with 2 patches
in total.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 2/9] ASoC: sun8i-codec-analog: split out linein and mic2
@ 2017-02-26  6:06     ` Chen-Yu Tsai
  0 siblings, 0 replies; 45+ messages in thread
From: Chen-Yu Tsai @ 2017-02-26  6:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Allwinner V3s SoC features an analog codec without linein and mic2.
>
> Split out them, in order to prepare for the analog codec on V3s.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>

Acked-by: Chen-Yu Tsai <wens@csie.org>

Though it would be better if you did 1 split as 1 patch, with 2 patches
in total.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
  2017-02-25 12:30   ` Icenowy Zheng
  (?)
@ 2017-02-26  6:16     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 45+ messages in thread
From: Chen-Yu Tsai @ 2017-02-26  6:16 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Mark Brown,
	dmaengine, devicetree, linux-arm-kernel, linux-kernel,
	Linux-ALSA

On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> The V3s SoC features an analog codec with headphone support but without
> mic2 and linein.

It doesn't have MBIAS either. Please split it out as well.

ChenYu

>
> Add support for it.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
>  sound/soc/sunxi/sun8i-codec-analog.c                           | 9 +++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> index 779b735781ba..1b6e7c4e50ab 100644
> --- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> +++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> @@ -4,6 +4,7 @@ Required properties:
>  - compatible: must be one of the following compatibles:
>                 - "allwinner,sun8i-a23-codec-analog"
>                 - "allwinner,sun8i-h3-codec-analog"
> +               - "allwinner,sun8i-v3s-codec-analog"
>
>  Required properties if not a sub-node of the PRCM node:
>  - reg: must contain the registers location and length
> diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
> index 6c17c99c2c8d..6375932177a3 100644
> --- a/sound/soc/sunxi/sun8i-codec-analog.c
> +++ b/sound/soc/sunxi/sun8i-codec-analog.c
> @@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
>         .has_mic2       = true,
>  };
>
> +static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
> +       .has_headphone  = true,
> +       .has_hmic       = true,
> +};
> +
>  static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
>  {
>         struct device *dev = cmpnt->dev;
> @@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
>                 .compatible = "allwinner,sun8i-h3-codec-analog",
>                 .data = &sun8i_h3_quirks,
>         },
> +       {
> +               .compatible = "allwinner,sun8i-v3s-codec-analog",
> +               .data = &sun8i_v3s_quirks,
> +       },
>         {}
>  };
>  MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
> --
> 2.11.1
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
@ 2017-02-26  6:16     ` Chen-Yu Tsai
  0 siblings, 0 replies; 45+ messages in thread
From: Chen-Yu Tsai @ 2017-02-26  6:16 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, Linux-ALSA, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, Maxime Ripard,
	linux-arm-kernel

On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> The V3s SoC features an analog codec with headphone support but without
> mic2 and linein.

It doesn't have MBIAS either. Please split it out as well.

ChenYu

>
> Add support for it.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
>  sound/soc/sunxi/sun8i-codec-analog.c                           | 9 +++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> index 779b735781ba..1b6e7c4e50ab 100644
> --- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> +++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> @@ -4,6 +4,7 @@ Required properties:
>  - compatible: must be one of the following compatibles:
>                 - "allwinner,sun8i-a23-codec-analog"
>                 - "allwinner,sun8i-h3-codec-analog"
> +               - "allwinner,sun8i-v3s-codec-analog"
>
>  Required properties if not a sub-node of the PRCM node:
>  - reg: must contain the registers location and length
> diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
> index 6c17c99c2c8d..6375932177a3 100644
> --- a/sound/soc/sunxi/sun8i-codec-analog.c
> +++ b/sound/soc/sunxi/sun8i-codec-analog.c
> @@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
>         .has_mic2       = true,
>  };
>
> +static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
> +       .has_headphone  = true,
> +       .has_hmic       = true,
> +};
> +
>  static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
>  {
>         struct device *dev = cmpnt->dev;
> @@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
>                 .compatible = "allwinner,sun8i-h3-codec-analog",
>                 .data = &sun8i_h3_quirks,
>         },
> +       {
> +               .compatible = "allwinner,sun8i-v3s-codec-analog",
> +               .data = &sun8i_v3s_quirks,
> +       },
>         {}
>  };
>  MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
> --
> 2.11.1
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
@ 2017-02-26  6:16     ` Chen-Yu Tsai
  0 siblings, 0 replies; 45+ messages in thread
From: Chen-Yu Tsai @ 2017-02-26  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> The V3s SoC features an analog codec with headphone support but without
> mic2 and linein.

It doesn't have MBIAS either. Please split it out as well.

ChenYu

>
> Add support for it.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
>  sound/soc/sunxi/sun8i-codec-analog.c                           | 9 +++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> index 779b735781ba..1b6e7c4e50ab 100644
> --- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> +++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
> @@ -4,6 +4,7 @@ Required properties:
>  - compatible: must be one of the following compatibles:
>                 - "allwinner,sun8i-a23-codec-analog"
>                 - "allwinner,sun8i-h3-codec-analog"
> +               - "allwinner,sun8i-v3s-codec-analog"
>
>  Required properties if not a sub-node of the PRCM node:
>  - reg: must contain the registers location and length
> diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
> index 6c17c99c2c8d..6375932177a3 100644
> --- a/sound/soc/sunxi/sun8i-codec-analog.c
> +++ b/sound/soc/sunxi/sun8i-codec-analog.c
> @@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
>         .has_mic2       = true,
>  };
>
> +static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
> +       .has_headphone  = true,
> +       .has_hmic       = true,
> +};
> +
>  static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
>  {
>         struct device *dev = cmpnt->dev;
> @@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
>                 .compatible = "allwinner,sun8i-h3-codec-analog",
>                 .data = &sun8i_h3_quirks,
>         },
> +       {
> +               .compatible = "allwinner,sun8i-v3s-codec-analog",
> +               .data = &sun8i_v3s_quirks,
> +       },
>         {}
>  };
>  MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
> --
> 2.11.1
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
  2017-02-26  6:16     ` Chen-Yu Tsai
@ 2017-02-26  7:08       ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-26  7:08 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: devicetree, Linux-ALSA, Vinod Koul, Mark Brown, linux-kernel,
	Rob Herring, dmaengine, Maxime Ripard, linux-arm-kernel



26.02.2017, 14:16, "Chen-Yu Tsai" <wens@csie.org>:
> On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
>>  The V3s SoC features an analog codec with headphone support but without
>>  mic2 and linein.
>
> It doesn't have MBIAS either. Please split it out as well.

Thanks for your tips ;-)

>
> ChenYu
>
>>  Add support for it.
>>
>>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>>  ---
>>   Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
>>   sound/soc/sunxi/sun8i-codec-analog.c | 9 +++++++++
>>   2 files changed, 10 insertions(+)
>>
>>  diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
>>  index 779b735781ba..1b6e7c4e50ab 100644
>>  --- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
>>  +++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
>>  @@ -4,6 +4,7 @@ Required properties:
>>   - compatible: must be one of the following compatibles:
>>                  - "allwinner,sun8i-a23-codec-analog"
>>                  - "allwinner,sun8i-h3-codec-analog"
>>  + - "allwinner,sun8i-v3s-codec-analog"
>>
>>   Required properties if not a sub-node of the PRCM node:
>>   - reg: must contain the registers location and length
>>  diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
>>  index 6c17c99c2c8d..6375932177a3 100644
>>  --- a/sound/soc/sunxi/sun8i-codec-analog.c
>>  +++ b/sound/soc/sunxi/sun8i-codec-analog.c
>>  @@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
>>          .has_mic2 = true,
>>   };
>>
>>  +static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
>>  + .has_headphone = true,
>>  + .has_hmic = true,
>>  +};
>>  +
>>   static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
>>   {
>>          struct device *dev = cmpnt->dev;
>>  @@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
>>                  .compatible = "allwinner,sun8i-h3-codec-analog",
>>                  .data = &sun8i_h3_quirks,
>>          },
>>  + {
>>  + .compatible = "allwinner,sun8i-v3s-codec-analog",
>>  + .data = &sun8i_v3s_quirks,
>>  + },
>>          {}
>>   };
>>   MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
>>  --
>>  2.11.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC
@ 2017-02-26  7:08       ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-26  7:08 UTC (permalink / raw)
  To: linux-arm-kernel



26.02.2017, 14:16, "Chen-Yu Tsai" <wens@csie.org>:
> On Sat, Feb 25, 2017 at 8:30 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
>> ?The V3s SoC features an analog codec with headphone support but without
>> ?mic2 and linein.
>
> It doesn't have MBIAS either. Please split it out as well.

Thanks for your tips ;-)

>
> ChenYu
>
>> ?Add support for it.
>>
>> ?Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>> ?---
>> ??Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt | 1 +
>> ??sound/soc/sunxi/sun8i-codec-analog.c | 9 +++++++++
>> ??2 files changed, 10 insertions(+)
>>
>> ?diff --git a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
>> ?index 779b735781ba..1b6e7c4e50ab 100644
>> ?--- a/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
>> ?+++ b/Documentation/devicetree/bindings/sound/sun8i-codec-analog.txt
>> ?@@ -4,6 +4,7 @@ Required properties:
>> ??- compatible: must be one of the following compatibles:
>> ?????????????????- "allwinner,sun8i-a23-codec-analog"
>> ?????????????????- "allwinner,sun8i-h3-codec-analog"
>> ?+ - "allwinner,sun8i-v3s-codec-analog"
>>
>> ??Required properties if not a sub-node of the PRCM node:
>> ??- reg: must contain the registers location and length
>> ?diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
>> ?index 6c17c99c2c8d..6375932177a3 100644
>> ?--- a/sound/soc/sunxi/sun8i-codec-analog.c
>> ?+++ b/sound/soc/sunxi/sun8i-codec-analog.c
>> ?@@ -695,6 +695,11 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
>> ?????????.has_mic2 = true,
>> ??};
>>
>> ?+static const struct sun8i_codec_analog_quirks sun8i_v3s_quirks = {
>> ?+ .has_headphone = true,
>> ?+ .has_hmic = true,
>> ?+};
>> ?+
>> ??static int sun8i_codec_analog_cmpnt_probe(struct snd_soc_component *cmpnt)
>> ??{
>> ?????????struct device *dev = cmpnt->dev;
>> ?@@ -762,6 +767,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
>> ?????????????????.compatible = "allwinner,sun8i-h3-codec-analog",
>> ?????????????????.data = &sun8i_h3_quirks,
>> ?????????},
>> ?+ {
>> ?+ .compatible = "allwinner,sun8i-v3s-codec-analog",
>> ?+ .data = &sun8i_v3s_quirks,
>> ?+ },
>> ?????????{}
>> ??};
>> ??MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match);
>> ?--
>> ?2.11.1

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
  2017-02-25 12:30 ` Icenowy Zheng
  (?)
@ 2017-02-27  7:49   ` Maxime Ripard
  -1 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-27  7:49 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Rob Herring, Chen-Yu Tsai, Mark Brown, dmaengine,
	devicetree, linux-arm-kernel, linux-kernel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

On Sat, Feb 25, 2017 at 08:30:21PM +0800, Icenowy Zheng wrote:
> Lichee Pi Zero features a dock, which adds some functions, and should be
> soldered with the core board of Lichee Pi Zero.
> 
> Add support for the dock as a new dts, as soldering is needed to make
> the dock usable and there's functions enabled on the dock that is
> unavailable at the 2.54mm pins of the core board.
> 
> Currently no new feature on core board is available in the mainline
> kernel, so the dock dt file only includes the core board device tree.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>

How does that relate to the rest of the serie, which seems to be about
the audio on V3s?

This should be clarified in a cover letter, but you know that already.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
@ 2017-02-27  7:49   ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-27  7:49 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, alsa-devel, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 873 bytes --]

On Sat, Feb 25, 2017 at 08:30:21PM +0800, Icenowy Zheng wrote:
> Lichee Pi Zero features a dock, which adds some functions, and should be
> soldered with the core board of Lichee Pi Zero.
> 
> Add support for the dock as a new dts, as soldering is needed to make
> the dock usable and there's functions enabled on the dock that is
> unavailable at the 2.54mm pins of the core board.
> 
> Currently no new feature on core board is available in the mainline
> kernel, so the dock dt file only includes the core board device tree.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>

How does that relate to the rest of the serie, which seems to be about
the audio on V3s?

This should be clarified in a cover letter, but you know that already.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
@ 2017-02-27  7:49   ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-27  7:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 25, 2017 at 08:30:21PM +0800, Icenowy Zheng wrote:
> Lichee Pi Zero features a dock, which adds some functions, and should be
> soldered with the core board of Lichee Pi Zero.
> 
> Add support for the dock as a new dts, as soldering is needed to make
> the dock usable and there's functions enabled on the dock that is
> unavailable at the 2.54mm pins of the core board.
> 
> Currently no new feature on core board is available in the mainline
> kernel, so the dock dt file only includes the core board device tree.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>

How does that relate to the rest of the serie, which seems to be about
the audio on V3s?

This should be clarified in a cover letter, but you know that already.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170227/b2e78d22/attachment.sig>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
  2017-02-25 12:30   ` Icenowy Zheng
  (?)
@ 2017-02-27  7:50     ` Maxime Ripard
  -1 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-27  7:50 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Rob Herring, Chen-Yu Tsai, Mark Brown, dmaengine,
	devicetree, linux-arm-kernel, linux-kernel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 2576 bytes --]

On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> Allwinner V3s has a DMA engine similar to the ones from A31, but with
> fewer channels and DRQs.
> 
> Add support for it.
> 
> As it also needs the special gate bit, make the gate bit generic.

That should be part of a separate patch.

> 
> According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> have also been specified gate_needed property.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  Documentation/devicetree/bindings/dma/sun6i-dma.txt |  1 +
>  drivers/dma/sun6i-dma.c                             | 17 ++++++++++++++---
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> index 6b267045f522..98fbe1a5c6dd 100644
> --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> @@ -9,6 +9,7 @@ Required properties:
>  		  "allwinner,sun8i-a23-dma"
>  		  "allwinner,sun8i-a83t-dma"
>  		  "allwinner,sun8i-h3-dma"
> +		  "allwinner,sun8i-v3s-dma"
>  - reg:		Should contain the registers base address and length
>  - interrupts:	Should contain a reference to the interrupt used by this device
>  - clocks:	Should contain a reference to the parent AHB clock
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index a2358780ab2c..1f38424c1b14 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -101,6 +101,7 @@ struct sun6i_dma_config {
>  	u32 nr_max_channels;
>  	u32 nr_max_requests;
>  	u32 nr_max_vchans;
> +	bool gate_needed;
>  };
>  
>  /*
> @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>  	.nr_max_channels = 8,
>  	.nr_max_requests = 24,
>  	.nr_max_vchans   = 37,
> +	.gate_needed	 = true,
>  };
>  
>  static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>  	.nr_max_channels = 8,
>  	.nr_max_requests = 28,
>  	.nr_max_vchans   = 39,
> +	.gate_needed	 = true,
>  };
>  
>  /*
> @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>  	.nr_max_vchans   = 34,
>  };
>  
> +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> +	.nr_max_channels = 8,
> +	.nr_max_requests = 23,
> +	.nr_max_vchans   = 24,

This one is suspicious. There's just a single endpoint that can be
used in both directions?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-27  7:50     ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-27  7:50 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, alsa-devel, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2576 bytes --]

On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> Allwinner V3s has a DMA engine similar to the ones from A31, but with
> fewer channels and DRQs.
> 
> Add support for it.
> 
> As it also needs the special gate bit, make the gate bit generic.

That should be part of a separate patch.

> 
> According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> have also been specified gate_needed property.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  Documentation/devicetree/bindings/dma/sun6i-dma.txt |  1 +
>  drivers/dma/sun6i-dma.c                             | 17 ++++++++++++++---
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> index 6b267045f522..98fbe1a5c6dd 100644
> --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> @@ -9,6 +9,7 @@ Required properties:
>  		  "allwinner,sun8i-a23-dma"
>  		  "allwinner,sun8i-a83t-dma"
>  		  "allwinner,sun8i-h3-dma"
> +		  "allwinner,sun8i-v3s-dma"
>  - reg:		Should contain the registers base address and length
>  - interrupts:	Should contain a reference to the interrupt used by this device
>  - clocks:	Should contain a reference to the parent AHB clock
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index a2358780ab2c..1f38424c1b14 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -101,6 +101,7 @@ struct sun6i_dma_config {
>  	u32 nr_max_channels;
>  	u32 nr_max_requests;
>  	u32 nr_max_vchans;
> +	bool gate_needed;
>  };
>  
>  /*
> @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>  	.nr_max_channels = 8,
>  	.nr_max_requests = 24,
>  	.nr_max_vchans   = 37,
> +	.gate_needed	 = true,
>  };
>  
>  static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>  	.nr_max_channels = 8,
>  	.nr_max_requests = 28,
>  	.nr_max_vchans   = 39,
> +	.gate_needed	 = true,
>  };
>  
>  /*
> @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>  	.nr_max_vchans   = 34,
>  };
>  
> +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> +	.nr_max_channels = 8,
> +	.nr_max_requests = 23,
> +	.nr_max_vchans   = 24,

This one is suspicious. There's just a single endpoint that can be
used in both directions?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-27  7:50     ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-27  7:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> Allwinner V3s has a DMA engine similar to the ones from A31, but with
> fewer channels and DRQs.
> 
> Add support for it.
> 
> As it also needs the special gate bit, make the gate bit generic.

That should be part of a separate patch.

> 
> According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> have also been specified gate_needed property.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  Documentation/devicetree/bindings/dma/sun6i-dma.txt |  1 +
>  drivers/dma/sun6i-dma.c                             | 17 ++++++++++++++---
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> index 6b267045f522..98fbe1a5c6dd 100644
> --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> @@ -9,6 +9,7 @@ Required properties:
>  		  "allwinner,sun8i-a23-dma"
>  		  "allwinner,sun8i-a83t-dma"
>  		  "allwinner,sun8i-h3-dma"
> +		  "allwinner,sun8i-v3s-dma"
>  - reg:		Should contain the registers base address and length
>  - interrupts:	Should contain a reference to the interrupt used by this device
>  - clocks:	Should contain a reference to the parent AHB clock
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index a2358780ab2c..1f38424c1b14 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -101,6 +101,7 @@ struct sun6i_dma_config {
>  	u32 nr_max_channels;
>  	u32 nr_max_requests;
>  	u32 nr_max_vchans;
> +	bool gate_needed;
>  };
>  
>  /*
> @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>  	.nr_max_channels = 8,
>  	.nr_max_requests = 24,
>  	.nr_max_vchans   = 37,
> +	.gate_needed	 = true,
>  };
>  
>  static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>  	.nr_max_channels = 8,
>  	.nr_max_requests = 28,
>  	.nr_max_vchans   = 39,
> +	.gate_needed	 = true,
>  };
>  
>  /*
> @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>  	.nr_max_vchans   = 34,
>  };
>  
> +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> +	.nr_max_channels = 8,
> +	.nr_max_requests = 23,
> +	.nr_max_vchans   = 24,

This one is suspicious. There's just a single endpoint that can be
used in both directions?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170227/ebb0ccd1/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
  2017-02-27  7:50     ` Maxime Ripard
@ 2017-02-27 10:48       ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-27 10:48 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, alsa-devel, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, linux-arm-kernel



27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
>>  Allwinner V3s has a DMA engine similar to the ones from A31, but with
>>  fewer channels and DRQs.
>>
>>  Add support for it.
>>
>>  As it also needs the special gate bit, make the gate bit generic.
>
> That should be part of a separate patch.

OK.

>
>>  According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
>>  have also been specified gate_needed property.
>>
>>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>>  ---
>>   Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
>>   drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
>>   2 files changed, 15 insertions(+), 3 deletions(-)
>>
>>  diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>>  index 6b267045f522..98fbe1a5c6dd 100644
>>  --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>>  +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>>  @@ -9,6 +9,7 @@ Required properties:
>>                     "allwinner,sun8i-a23-dma"
>>                     "allwinner,sun8i-a83t-dma"
>>                     "allwinner,sun8i-h3-dma"
>>  + "allwinner,sun8i-v3s-dma"
>>   - reg: Should contain the registers base address and length
>>   - interrupts: Should contain a reference to the interrupt used by this device
>>   - clocks: Should contain a reference to the parent AHB clock
>>  diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
>>  index a2358780ab2c..1f38424c1b14 100644
>>  --- a/drivers/dma/sun6i-dma.c
>>  +++ b/drivers/dma/sun6i-dma.c
>>  @@ -101,6 +101,7 @@ struct sun6i_dma_config {
>>           u32 nr_max_channels;
>>           u32 nr_max_requests;
>>           u32 nr_max_vchans;
>>  + bool gate_needed;
>>   };
>>
>>   /*
>>  @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>>           .nr_max_channels = 8,
>>           .nr_max_requests = 24,
>>           .nr_max_vchans = 37,
>>  + .gate_needed = true,
>>   };
>>
>>   static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>>           .nr_max_channels = 8,
>>           .nr_max_requests = 28,
>>           .nr_max_vchans = 39,
>>  + .gate_needed = true,
>>   };
>>
>>   /*
>>  @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>>           .nr_max_vchans = 34,
>>   };
>>
>>  +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
>>  + .nr_max_channels = 8,
>>  + .nr_max_requests = 23,
>>  + .nr_max_vchans = 24,
>
> This one is suspicious. There's just a single endpoint that can be
> used in both directions?

nr_max_vchans is the endpoint number. nr_max_requests is the
maximum DRQ number, for V3s, according to the datasheet, it's
23: SPI0_{R,T}X.

>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-27 10:48       ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-27 10:48 UTC (permalink / raw)
  To: linux-arm-kernel



27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
>> ?Allwinner V3s has a DMA engine similar to the ones from A31, but with
>> ?fewer channels and DRQs.
>>
>> ?Add support for it.
>>
>> ?As it also needs the special gate bit, make the gate bit generic.
>
> That should be part of a separate patch.

OK.

>
>> ?According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
>> ?have also been specified gate_needed property.
>>
>> ?Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>> ?---
>> ??Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
>> ??drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
>> ??2 files changed, 15 insertions(+), 3 deletions(-)
>>
>> ?diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>> ?index 6b267045f522..98fbe1a5c6dd 100644
>> ?--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>> ?+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>> ?@@ -9,6 +9,7 @@ Required properties:
>> ????????????????????"allwinner,sun8i-a23-dma"
>> ????????????????????"allwinner,sun8i-a83t-dma"
>> ????????????????????"allwinner,sun8i-h3-dma"
>> ?+ "allwinner,sun8i-v3s-dma"
>> ??- reg: Should contain the registers base address and length
>> ??- interrupts: Should contain a reference to the interrupt used by this device
>> ??- clocks: Should contain a reference to the parent AHB clock
>> ?diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
>> ?index a2358780ab2c..1f38424c1b14 100644
>> ?--- a/drivers/dma/sun6i-dma.c
>> ?+++ b/drivers/dma/sun6i-dma.c
>> ?@@ -101,6 +101,7 @@ struct sun6i_dma_config {
>> ??????????u32 nr_max_channels;
>> ??????????u32 nr_max_requests;
>> ??????????u32 nr_max_vchans;
>> ?+ bool gate_needed;
>> ??};
>>
>> ??/*
>> ?@@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>> ??????????.nr_max_channels = 8,
>> ??????????.nr_max_requests = 24,
>> ??????????.nr_max_vchans = 37,
>> ?+ .gate_needed = true,
>> ??};
>>
>> ??static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>> ??????????.nr_max_channels = 8,
>> ??????????.nr_max_requests = 28,
>> ??????????.nr_max_vchans = 39,
>> ?+ .gate_needed = true,
>> ??};
>>
>> ??/*
>> ?@@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>> ??????????.nr_max_vchans = 34,
>> ??};
>>
>> ?+static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
>> ?+ .nr_max_channels = 8,
>> ?+ .nr_max_requests = 23,
>> ?+ .nr_max_vchans = 24,
>
> This one is suspicious. There's just a single endpoint that can be
> used in both directions?

nr_max_vchans is the endpoint number. nr_max_requests is the
maximum DRQ number, for V3s, according to the datasheet, it's
23: SPI0_{R,T}X.

>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
  2017-02-27 10:48       ` Icenowy Zheng
  (?)
@ 2017-02-28 17:56         ` Maxime Ripard
  -1 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-28 17:56 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Rob Herring, Chen-Yu Tsai, Mark Brown, dmaengine,
	devicetree, linux-arm-kernel, linux-kernel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 3284 bytes --]

On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
> 
> 
> 27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> > On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> >>  Allwinner V3s has a DMA engine similar to the ones from A31, but with
> >>  fewer channels and DRQs.
> >>
> >>  Add support for it.
> >>
> >>  As it also needs the special gate bit, make the gate bit generic.
> >
> > That should be part of a separate patch.
> 
> OK.
> 
> >
> >>  According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> >>  have also been specified gate_needed property.
> >>
> >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >>  ---
> >>   Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
> >>   drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
> >>   2 files changed, 15 insertions(+), 3 deletions(-)
> >>
> >>  diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  index 6b267045f522..98fbe1a5c6dd 100644
> >>  --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  @@ -9,6 +9,7 @@ Required properties:
> >>                     "allwinner,sun8i-a23-dma"
> >>                     "allwinner,sun8i-a83t-dma"
> >>                     "allwinner,sun8i-h3-dma"
> >>  + "allwinner,sun8i-v3s-dma"
> >>   - reg: Should contain the registers base address and length
> >>   - interrupts: Should contain a reference to the interrupt used by this device
> >>   - clocks: Should contain a reference to the parent AHB clock
> >>  diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> >>  index a2358780ab2c..1f38424c1b14 100644
> >>  --- a/drivers/dma/sun6i-dma.c
> >>  +++ b/drivers/dma/sun6i-dma.c
> >>  @@ -101,6 +101,7 @@ struct sun6i_dma_config {
> >>           u32 nr_max_channels;
> >>           u32 nr_max_requests;
> >>           u32 nr_max_vchans;
> >>  + bool gate_needed;
> >>   };
> >>
> >>   /*
> >>  @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
> >>           .nr_max_channels = 8,
> >>           .nr_max_requests = 24,
> >>           .nr_max_vchans = 37,
> >>  + .gate_needed = true,
> >>   };
> >>
> >>   static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
> >>           .nr_max_channels = 8,
> >>           .nr_max_requests = 28,
> >>           .nr_max_vchans = 39,
> >>  + .gate_needed = true,
> >>   };
> >>
> >>   /*
> >>  @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
> >>           .nr_max_vchans = 34,
> >>   };
> >>
> >>  +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> >>  + .nr_max_channels = 8,
> >>  + .nr_max_requests = 23,
> >>  + .nr_max_vchans = 24,
> >
> > This one is suspicious. There's just a single endpoint that can be
> > used in both directions?
> 
> nr_max_vchans is the endpoint number. nr_max_requests is the
> maximum DRQ number, for V3s, according to the datasheet, it's
> 23: SPI0_{R,T}X.

There's not a lot of endpoints indeed, but you need 28 vchans (2 *
14).

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-28 17:56         ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-28 17:56 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, alsa-devel, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 3284 bytes --]

On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
> 
> 
> 27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> > On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> >>  Allwinner V3s has a DMA engine similar to the ones from A31, but with
> >>  fewer channels and DRQs.
> >>
> >>  Add support for it.
> >>
> >>  As it also needs the special gate bit, make the gate bit generic.
> >
> > That should be part of a separate patch.
> 
> OK.
> 
> >
> >>  According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> >>  have also been specified gate_needed property.
> >>
> >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >>  ---
> >>   Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
> >>   drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
> >>   2 files changed, 15 insertions(+), 3 deletions(-)
> >>
> >>  diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  index 6b267045f522..98fbe1a5c6dd 100644
> >>  --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  @@ -9,6 +9,7 @@ Required properties:
> >>                     "allwinner,sun8i-a23-dma"
> >>                     "allwinner,sun8i-a83t-dma"
> >>                     "allwinner,sun8i-h3-dma"
> >>  + "allwinner,sun8i-v3s-dma"
> >>   - reg: Should contain the registers base address and length
> >>   - interrupts: Should contain a reference to the interrupt used by this device
> >>   - clocks: Should contain a reference to the parent AHB clock
> >>  diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> >>  index a2358780ab2c..1f38424c1b14 100644
> >>  --- a/drivers/dma/sun6i-dma.c
> >>  +++ b/drivers/dma/sun6i-dma.c
> >>  @@ -101,6 +101,7 @@ struct sun6i_dma_config {
> >>           u32 nr_max_channels;
> >>           u32 nr_max_requests;
> >>           u32 nr_max_vchans;
> >>  + bool gate_needed;
> >>   };
> >>
> >>   /*
> >>  @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
> >>           .nr_max_channels = 8,
> >>           .nr_max_requests = 24,
> >>           .nr_max_vchans = 37,
> >>  + .gate_needed = true,
> >>   };
> >>
> >>   static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
> >>           .nr_max_channels = 8,
> >>           .nr_max_requests = 28,
> >>           .nr_max_vchans = 39,
> >>  + .gate_needed = true,
> >>   };
> >>
> >>   /*
> >>  @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
> >>           .nr_max_vchans = 34,
> >>   };
> >>
> >>  +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> >>  + .nr_max_channels = 8,
> >>  + .nr_max_requests = 23,
> >>  + .nr_max_vchans = 24,
> >
> > This one is suspicious. There's just a single endpoint that can be
> > used in both directions?
> 
> nr_max_vchans is the endpoint number. nr_max_requests is the
> maximum DRQ number, for V3s, according to the datasheet, it's
> 23: SPI0_{R,T}X.

There's not a lot of endpoints indeed, but you need 28 vchans (2 *
14).

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-28 17:56         ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-02-28 17:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
> 
> 
> 27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> > On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> >> ?Allwinner V3s has a DMA engine similar to the ones from A31, but with
> >> ?fewer channels and DRQs.
> >>
> >> ?Add support for it.
> >>
> >> ?As it also needs the special gate bit, make the gate bit generic.
> >
> > That should be part of a separate patch.
> 
> OK.
> 
> >
> >> ?According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> >> ?have also been specified gate_needed property.
> >>
> >> ?Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >> ?---
> >> ??Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
> >> ??drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
> >> ??2 files changed, 15 insertions(+), 3 deletions(-)
> >>
> >> ?diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >> ?index 6b267045f522..98fbe1a5c6dd 100644
> >> ?--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >> ?+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >> ?@@ -9,6 +9,7 @@ Required properties:
> >> ????????????????????"allwinner,sun8i-a23-dma"
> >> ????????????????????"allwinner,sun8i-a83t-dma"
> >> ????????????????????"allwinner,sun8i-h3-dma"
> >> ?+ "allwinner,sun8i-v3s-dma"
> >> ??- reg: Should contain the registers base address and length
> >> ??- interrupts: Should contain a reference to the interrupt used by this device
> >> ??- clocks: Should contain a reference to the parent AHB clock
> >> ?diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> >> ?index a2358780ab2c..1f38424c1b14 100644
> >> ?--- a/drivers/dma/sun6i-dma.c
> >> ?+++ b/drivers/dma/sun6i-dma.c
> >> ?@@ -101,6 +101,7 @@ struct sun6i_dma_config {
> >> ??????????u32 nr_max_channels;
> >> ??????????u32 nr_max_requests;
> >> ??????????u32 nr_max_vchans;
> >> ?+ bool gate_needed;
> >> ??};
> >>
> >> ??/*
> >> ?@@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
> >> ??????????.nr_max_channels = 8,
> >> ??????????.nr_max_requests = 24,
> >> ??????????.nr_max_vchans = 37,
> >> ?+ .gate_needed = true,
> >> ??};
> >>
> >> ??static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
> >> ??????????.nr_max_channels = 8,
> >> ??????????.nr_max_requests = 28,
> >> ??????????.nr_max_vchans = 39,
> >> ?+ .gate_needed = true,
> >> ??};
> >>
> >> ??/*
> >> ?@@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
> >> ??????????.nr_max_vchans = 34,
> >> ??};
> >>
> >> ?+static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> >> ?+ .nr_max_channels = 8,
> >> ?+ .nr_max_requests = 23,
> >> ?+ .nr_max_vchans = 24,
> >
> > This one is suspicious. There's just a single endpoint that can be
> > used in both directions?
> 
> nr_max_vchans is the endpoint number. nr_max_requests is the
> maximum DRQ number, for V3s, according to the datasheet, it's
> 23: SPI0_{R,T}X.

There's not a lot of endpoints indeed, but you need 28 vchans (2 *
14).

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170228/0a0b8dc9/attachment.sig>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
  2017-02-28 17:56         ` Maxime Ripard
@ 2017-02-28 17:58           ` Icenowy Zheng
  -1 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-28 17:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: devicetree, alsa-devel, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, linux-arm-kernel



01.03.2017, 01:56, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
>>  27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
>>  > On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
>>  >>  Allwinner V3s has a DMA engine similar to the ones from A31, but with
>>  >>  fewer channels and DRQs.
>>  >>
>>  >>  Add support for it.
>>  >>
>>  >>  As it also needs the special gate bit, make the gate bit generic.
>>  >
>>  > That should be part of a separate patch.
>>
>>  OK.
>>
>>  >
>>  >>  According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
>>  >>  have also been specified gate_needed property.
>>  >>
>>  >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>>  >>  ---
>>  >>   Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
>>  >>   drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
>>  >>   2 files changed, 15 insertions(+), 3 deletions(-)
>>  >>
>>  >>  diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>>  >>  index 6b267045f522..98fbe1a5c6dd 100644
>>  >>  --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>>  >>  +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>>  >>  @@ -9,6 +9,7 @@ Required properties:
>>  >>                     "allwinner,sun8i-a23-dma"
>>  >>                     "allwinner,sun8i-a83t-dma"
>>  >>                     "allwinner,sun8i-h3-dma"
>>  >>  + "allwinner,sun8i-v3s-dma"
>>  >>   - reg: Should contain the registers base address and length
>>  >>   - interrupts: Should contain a reference to the interrupt used by this device
>>  >>   - clocks: Should contain a reference to the parent AHB clock
>>  >>  diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
>>  >>  index a2358780ab2c..1f38424c1b14 100644
>>  >>  --- a/drivers/dma/sun6i-dma.c
>>  >>  +++ b/drivers/dma/sun6i-dma.c
>>  >>  @@ -101,6 +101,7 @@ struct sun6i_dma_config {
>>  >>           u32 nr_max_channels;
>>  >>           u32 nr_max_requests;
>>  >>           u32 nr_max_vchans;
>>  >>  + bool gate_needed;
>>  >>   };
>>  >>
>>  >>   /*
>>  >>  @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>>  >>           .nr_max_channels = 8,
>>  >>           .nr_max_requests = 24,
>>  >>           .nr_max_vchans = 37,
>>  >>  + .gate_needed = true,
>>  >>   };
>>  >>
>>  >>   static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>>  >>           .nr_max_channels = 8,
>>  >>           .nr_max_requests = 28,
>>  >>           .nr_max_vchans = 39,
>>  >>  + .gate_needed = true,
>>  >>   };
>>  >>
>>  >>   /*
>>  >>  @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>>  >>           .nr_max_vchans = 34,
>>  >>   };
>>  >>
>>  >>  +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
>>  >>  + .nr_max_channels = 8,
>>  >>  + .nr_max_requests = 23,
>>  >>  + .nr_max_vchans = 24,
>>  >
>>  > This one is suspicious. There's just a single endpoint that can be
>>  > used in both directions?
>>
>>  nr_max_vchans is the endpoint number. nr_max_requests is the
>>  maximum DRQ number, for V3s, according to the datasheet, it's
>>  23: SPI0_{R,T}X.
>
> There's not a lot of endpoints indeed, but you need 28 vchans (2 *
> 14).

Sorry but I counted only 12 pairs of vchans:
Port 0. SRAM
Port 1. SDRAM
Port 6. UART0
Port 7. UART1
Port 8. UART2
Port 15. Audio Codec
Port 16. CE
Port 17. OTG EP1
Port 18. OTG EP2
Port 19. OTG EP3
Port 20. OTG EP4
Port 23. SPI0

>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-02-28 17:58           ` Icenowy Zheng
  0 siblings, 0 replies; 45+ messages in thread
From: Icenowy Zheng @ 2017-02-28 17:58 UTC (permalink / raw)
  To: linux-arm-kernel



01.03.2017, 01:56, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
>> ?27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
>> ?> On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
>> ?>> ?Allwinner V3s has a DMA engine similar to the ones from A31, but with
>> ?>> ?fewer channels and DRQs.
>> ?>>
>> ?>> ?Add support for it.
>> ?>>
>> ?>> ?As it also needs the special gate bit, make the gate bit generic.
>> ?>
>> ?> That should be part of a separate patch.
>>
>> ?OK.
>>
>> ?>
>> ?>> ?According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
>> ?>> ?have also been specified gate_needed property.
>> ?>>
>> ?>> ?Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>> ?>> ?---
>> ?>> ??Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
>> ?>> ??drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
>> ?>> ??2 files changed, 15 insertions(+), 3 deletions(-)
>> ?>>
>> ?>> ?diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>> ?>> ?index 6b267045f522..98fbe1a5c6dd 100644
>> ?>> ?--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>> ?>> ?+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
>> ?>> ?@@ -9,6 +9,7 @@ Required properties:
>> ?>> ????????????????????"allwinner,sun8i-a23-dma"
>> ?>> ????????????????????"allwinner,sun8i-a83t-dma"
>> ?>> ????????????????????"allwinner,sun8i-h3-dma"
>> ?>> ?+ "allwinner,sun8i-v3s-dma"
>> ?>> ??- reg: Should contain the registers base address and length
>> ?>> ??- interrupts: Should contain a reference to the interrupt used by this device
>> ?>> ??- clocks: Should contain a reference to the parent AHB clock
>> ?>> ?diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
>> ?>> ?index a2358780ab2c..1f38424c1b14 100644
>> ?>> ?--- a/drivers/dma/sun6i-dma.c
>> ?>> ?+++ b/drivers/dma/sun6i-dma.c
>> ?>> ?@@ -101,6 +101,7 @@ struct sun6i_dma_config {
>> ?>> ??????????u32 nr_max_channels;
>> ?>> ??????????u32 nr_max_requests;
>> ?>> ??????????u32 nr_max_vchans;
>> ?>> ?+ bool gate_needed;
>> ?>> ??};
>> ?>>
>> ?>> ??/*
>> ?>> ?@@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
>> ?>> ??????????.nr_max_channels = 8,
>> ?>> ??????????.nr_max_requests = 24,
>> ?>> ??????????.nr_max_vchans = 37,
>> ?>> ?+ .gate_needed = true,
>> ?>> ??};
>> ?>>
>> ?>> ??static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
>> ?>> ??????????.nr_max_channels = 8,
>> ?>> ??????????.nr_max_requests = 28,
>> ?>> ??????????.nr_max_vchans = 39,
>> ?>> ?+ .gate_needed = true,
>> ?>> ??};
>> ?>>
>> ?>> ??/*
>> ?>> ?@@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
>> ?>> ??????????.nr_max_vchans = 34,
>> ?>> ??};
>> ?>>
>> ?>> ?+static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
>> ?>> ?+ .nr_max_channels = 8,
>> ?>> ?+ .nr_max_requests = 23,
>> ?>> ?+ .nr_max_vchans = 24,
>> ?>
>> ?> This one is suspicious. There's just a single endpoint that can be
>> ?> used in both directions?
>>
>> ?nr_max_vchans is the endpoint number. nr_max_requests is the
>> ?maximum DRQ number, for V3s, according to the datasheet, it's
>> ?23: SPI0_{R,T}X.
>
> There's not a lot of endpoints indeed, but you need 28 vchans (2 *
> 14).

Sorry but I counted only 12 pairs of vchans:
Port 0. SRAM
Port 1. SDRAM
Port 6. UART0
Port 7. UART1
Port 8. UART2
Port 15. Audio Codec
Port 16. CE
Port 17. OTG EP1
Port 18. OTG EP2
Port 19. OTG EP3
Port 20. OTG EP4
Port 23. SPI0

>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
  2017-02-25 12:30 ` Icenowy Zheng
  (?)
@ 2017-02-28 23:02   ` Rob Herring
  -1 siblings, 0 replies; 45+ messages in thread
From: Rob Herring @ 2017-02-28 23:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Maxime Ripard, Chen-Yu Tsai, Mark Brown, dmaengine,
	devicetree, linux-arm-kernel, linux-kernel, Linux-ALSA

On Sat, Feb 25, 2017 at 6:30 AM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Lichee Pi Zero features a dock, which adds some functions, and should be
> soldered with the core board of Lichee Pi Zero.
>
> Add support for the dock as a new dts, as soldering is needed to make
> the dock usable and there's functions enabled on the dock that is
> unavailable at the 2.54mm pins of the core board.
>
> Currently no new feature on core board is available in the mainline
> kernel, so the dock dt file only includes the core board device tree.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  arch/arm/boot/dts/Makefile                         |  3 +-
>  arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 49 ++++++++++++++++++++++
>  2 files changed, 51 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 011808490fed..1aa365306479 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -876,7 +876,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>         sun8i-h3-orangepi-plus.dtb \
>         sun8i-h3-orangepi-plus2e.dtb \
>         sun8i-r16-parrot.dtb \
> -       sun8i-v3s-licheepi-zero.dtb
> +       sun8i-v3s-licheepi-zero.dtb \
> +       sun8i-v3s-licheepi-zero-dock.dtb
>  dtb-$(CONFIG_MACH_SUN9I) += \
>         sun9i-a80-optimus.dtb \
>         sun9i-a80-cubieboard4.dtb
> diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
> new file mode 100644
> index 000000000000..68c114d6b939
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This file is free software; you can redistribute it and/or
> + *     modify it under the terms of the GNU General Public License as
> + *     published by the Free Software Foundation; either version 2 of the
> + *     License, or (at your option) any later version.
> + *
> + *     This file 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.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + *     obtaining a copy of this software and associated documentation
> + *     files (the "Software"), to deal in the Software without
> + *     restriction, including without limitation the rights to use,
> + *     copy, modify, merge, publish, distribute, sublicense, and/or
> + *     sell copies of the Software, and to permit persons to whom the
> + *     Software is furnished to do so, subject to the following
> + *     conditions:
> + *
> + *     The above copyright notice and this permission notice shall be
> + *     included in all copies or substantial portions of the Software.
> + *
> + *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + *     OTHER DEALINGS IN THE SOFTWARE.

Use SPDX tags here:

SPDX-License-Identifier: (GPL-2.0+ OR MIT)

While it says X11, this is really MIT license text.

> + */
> +
> +#include "sun8i-v3s-licheepi-zero.dts"
> +
> +/ {
> +       model = "Lichee Pi Zero with Dock";
> +       compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
> +                    "allwinner,sun8i-v3s";
> +};
> --
> 2.11.1
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
@ 2017-02-28 23:02   ` Rob Herring
  0 siblings, 0 replies; 45+ messages in thread
From: Rob Herring @ 2017-02-28 23:02 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, Linux-ALSA, Vinod Koul, linux-kernel, Chen-Yu Tsai,
	Mark Brown, dmaengine, Maxime Ripard, linux-arm-kernel

On Sat, Feb 25, 2017 at 6:30 AM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Lichee Pi Zero features a dock, which adds some functions, and should be
> soldered with the core board of Lichee Pi Zero.
>
> Add support for the dock as a new dts, as soldering is needed to make
> the dock usable and there's functions enabled on the dock that is
> unavailable at the 2.54mm pins of the core board.
>
> Currently no new feature on core board is available in the mainline
> kernel, so the dock dt file only includes the core board device tree.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  arch/arm/boot/dts/Makefile                         |  3 +-
>  arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 49 ++++++++++++++++++++++
>  2 files changed, 51 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 011808490fed..1aa365306479 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -876,7 +876,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>         sun8i-h3-orangepi-plus.dtb \
>         sun8i-h3-orangepi-plus2e.dtb \
>         sun8i-r16-parrot.dtb \
> -       sun8i-v3s-licheepi-zero.dtb
> +       sun8i-v3s-licheepi-zero.dtb \
> +       sun8i-v3s-licheepi-zero-dock.dtb
>  dtb-$(CONFIG_MACH_SUN9I) += \
>         sun9i-a80-optimus.dtb \
>         sun9i-a80-cubieboard4.dtb
> diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
> new file mode 100644
> index 000000000000..68c114d6b939
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This file is free software; you can redistribute it and/or
> + *     modify it under the terms of the GNU General Public License as
> + *     published by the Free Software Foundation; either version 2 of the
> + *     License, or (at your option) any later version.
> + *
> + *     This file 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.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + *     obtaining a copy of this software and associated documentation
> + *     files (the "Software"), to deal in the Software without
> + *     restriction, including without limitation the rights to use,
> + *     copy, modify, merge, publish, distribute, sublicense, and/or
> + *     sell copies of the Software, and to permit persons to whom the
> + *     Software is furnished to do so, subject to the following
> + *     conditions:
> + *
> + *     The above copyright notice and this permission notice shall be
> + *     included in all copies or substantial portions of the Software.
> + *
> + *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + *     OTHER DEALINGS IN THE SOFTWARE.

Use SPDX tags here:

SPDX-License-Identifier: (GPL-2.0+ OR MIT)

While it says X11, this is really MIT license text.

> + */
> +
> +#include "sun8i-v3s-licheepi-zero.dts"
> +
> +/ {
> +       model = "Lichee Pi Zero with Dock";
> +       compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
> +                    "allwinner,sun8i-v3s";
> +};
> --
> 2.11.1
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock
@ 2017-02-28 23:02   ` Rob Herring
  0 siblings, 0 replies; 45+ messages in thread
From: Rob Herring @ 2017-02-28 23:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Feb 25, 2017 at 6:30 AM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> Lichee Pi Zero features a dock, which adds some functions, and should be
> soldered with the core board of Lichee Pi Zero.
>
> Add support for the dock as a new dts, as soldering is needed to make
> the dock usable and there's functions enabled on the dock that is
> unavailable at the 2.54mm pins of the core board.
>
> Currently no new feature on core board is available in the mainline
> kernel, so the dock dt file only includes the core board device tree.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  arch/arm/boot/dts/Makefile                         |  3 +-
>  arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 49 ++++++++++++++++++++++
>  2 files changed, 51 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 011808490fed..1aa365306479 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -876,7 +876,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>         sun8i-h3-orangepi-plus.dtb \
>         sun8i-h3-orangepi-plus2e.dtb \
>         sun8i-r16-parrot.dtb \
> -       sun8i-v3s-licheepi-zero.dtb
> +       sun8i-v3s-licheepi-zero.dtb \
> +       sun8i-v3s-licheepi-zero-dock.dtb
>  dtb-$(CONFIG_MACH_SUN9I) += \
>         sun9i-a80-optimus.dtb \
>         sun9i-a80-cubieboard4.dtb
> diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
> new file mode 100644
> index 000000000000..68c114d6b939
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This file is free software; you can redistribute it and/or
> + *     modify it under the terms of the GNU General Public License as
> + *     published by the Free Software Foundation; either version 2 of the
> + *     License, or (at your option) any later version.
> + *
> + *     This file 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.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + *     obtaining a copy of this software and associated documentation
> + *     files (the "Software"), to deal in the Software without
> + *     restriction, including without limitation the rights to use,
> + *     copy, modify, merge, publish, distribute, sublicense, and/or
> + *     sell copies of the Software, and to permit persons to whom the
> + *     Software is furnished to do so, subject to the following
> + *     conditions:
> + *
> + *     The above copyright notice and this permission notice shall be
> + *     included in all copies or substantial portions of the Software.
> + *
> + *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + *     OTHER DEALINGS IN THE SOFTWARE.

Use SPDX tags here:

SPDX-License-Identifier: (GPL-2.0+ OR MIT)

While it says X11, this is really MIT license text.

> + */
> +
> +#include "sun8i-v3s-licheepi-zero.dts"
> +
> +/ {
> +       model = "Lichee Pi Zero with Dock";
> +       compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
> +                    "allwinner,sun8i-v3s";
> +};
> --
> 2.11.1
>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
  2017-02-28 17:58           ` Icenowy Zheng
  (?)
@ 2017-03-01  9:32             ` Maxime Ripard
  -1 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-03-01  9:32 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Vinod Koul, Rob Herring, Chen-Yu Tsai, Mark Brown, dmaengine,
	devicetree, linux-arm-kernel, linux-kernel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 4176 bytes --]

On Wed, Mar 01, 2017 at 01:58:33AM +0800, Icenowy Zheng wrote:
> 
> 
> 01.03.2017, 01:56, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> > On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
> >>  27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> >>  > On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> >>  >>  Allwinner V3s has a DMA engine similar to the ones from A31, but with
> >>  >>  fewer channels and DRQs.
> >>  >>
> >>  >>  Add support for it.
> >>  >>
> >>  >>  As it also needs the special gate bit, make the gate bit generic.
> >>  >
> >>  > That should be part of a separate patch.
> >>
> >>  OK.
> >>
> >>  >
> >>  >>  According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> >>  >>  have also been specified gate_needed property.
> >>  >>
> >>  >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >>  >>  ---
> >>  >>   Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
> >>  >>   drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
> >>  >>   2 files changed, 15 insertions(+), 3 deletions(-)
> >>  >>
> >>  >>  diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  >>  index 6b267045f522..98fbe1a5c6dd 100644
> >>  >>  --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  >>  +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  >>  @@ -9,6 +9,7 @@ Required properties:
> >>  >>                     "allwinner,sun8i-a23-dma"
> >>  >>                     "allwinner,sun8i-a83t-dma"
> >>  >>                     "allwinner,sun8i-h3-dma"
> >>  >>  + "allwinner,sun8i-v3s-dma"
> >>  >>   - reg: Should contain the registers base address and length
> >>  >>   - interrupts: Should contain a reference to the interrupt used by this device
> >>  >>   - clocks: Should contain a reference to the parent AHB clock
> >>  >>  diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> >>  >>  index a2358780ab2c..1f38424c1b14 100644
> >>  >>  --- a/drivers/dma/sun6i-dma.c
> >>  >>  +++ b/drivers/dma/sun6i-dma.c
> >>  >>  @@ -101,6 +101,7 @@ struct sun6i_dma_config {
> >>  >>           u32 nr_max_channels;
> >>  >>           u32 nr_max_requests;
> >>  >>           u32 nr_max_vchans;
> >>  >>  + bool gate_needed;
> >>  >>   };
> >>  >>
> >>  >>   /*
> >>  >>  @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
> >>  >>           .nr_max_channels = 8,
> >>  >>           .nr_max_requests = 24,
> >>  >>           .nr_max_vchans = 37,
> >>  >>  + .gate_needed = true,
> >>  >>   };
> >>  >>
> >>  >>   static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
> >>  >>           .nr_max_channels = 8,
> >>  >>           .nr_max_requests = 28,
> >>  >>           .nr_max_vchans = 39,
> >>  >>  + .gate_needed = true,
> >>  >>   };
> >>  >>
> >>  >>   /*
> >>  >>  @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
> >>  >>           .nr_max_vchans = 34,
> >>  >>   };
> >>  >>
> >>  >>  +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> >>  >>  + .nr_max_channels = 8,
> >>  >>  + .nr_max_requests = 23,
> >>  >>  + .nr_max_vchans = 24,
> >>  >
> >>  > This one is suspicious. There's just a single endpoint that can be
> >>  > used in both directions?
> >>
> >>  nr_max_vchans is the endpoint number. nr_max_requests is the
> >>  maximum DRQ number, for V3s, according to the datasheet, it's
> >>  23: SPI0_{R,T}X.
> >
> > There's not a lot of endpoints indeed, but you need 28 vchans (2 *
> > 14).
> 
> Sorry but I counted only 12 pairs of vchans:
> Port 0. SRAM
> Port 1. SDRAM
> Port 6. UART0
> Port 7. UART1
> Port 8. UART2
> Port 15. Audio Codec
> Port 16. CE
> Port 17. OTG EP1
> Port 18. OTG EP2
> Port 19. OTG EP3
> Port 20. OTG EP4
> Port 23. SPI0

It seems like I can't count anymore... Yes, you're right, sorry.

Having a comment on top of the structure, just like all the other SoCs
would be nice though.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-03-01  9:32             ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-03-01  9:32 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: devicetree, alsa-devel, Vinod Koul, Mark Brown, linux-kernel,
	Chen-Yu Tsai, Rob Herring, dmaengine, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 4176 bytes --]

On Wed, Mar 01, 2017 at 01:58:33AM +0800, Icenowy Zheng wrote:
> 
> 
> 01.03.2017, 01:56, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> > On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
> >>  27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> >>  > On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> >>  >>  Allwinner V3s has a DMA engine similar to the ones from A31, but with
> >>  >>  fewer channels and DRQs.
> >>  >>
> >>  >>  Add support for it.
> >>  >>
> >>  >>  As it also needs the special gate bit, make the gate bit generic.
> >>  >
> >>  > That should be part of a separate patch.
> >>
> >>  OK.
> >>
> >>  >
> >>  >>  According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> >>  >>  have also been specified gate_needed property.
> >>  >>
> >>  >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >>  >>  ---
> >>  >>   Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
> >>  >>   drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
> >>  >>   2 files changed, 15 insertions(+), 3 deletions(-)
> >>  >>
> >>  >>  diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  >>  index 6b267045f522..98fbe1a5c6dd 100644
> >>  >>  --- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  >>  +++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >>  >>  @@ -9,6 +9,7 @@ Required properties:
> >>  >>                     "allwinner,sun8i-a23-dma"
> >>  >>                     "allwinner,sun8i-a83t-dma"
> >>  >>                     "allwinner,sun8i-h3-dma"
> >>  >>  + "allwinner,sun8i-v3s-dma"
> >>  >>   - reg: Should contain the registers base address and length
> >>  >>   - interrupts: Should contain a reference to the interrupt used by this device
> >>  >>   - clocks: Should contain a reference to the parent AHB clock
> >>  >>  diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> >>  >>  index a2358780ab2c..1f38424c1b14 100644
> >>  >>  --- a/drivers/dma/sun6i-dma.c
> >>  >>  +++ b/drivers/dma/sun6i-dma.c
> >>  >>  @@ -101,6 +101,7 @@ struct sun6i_dma_config {
> >>  >>           u32 nr_max_channels;
> >>  >>           u32 nr_max_requests;
> >>  >>           u32 nr_max_vchans;
> >>  >>  + bool gate_needed;
> >>  >>   };
> >>  >>
> >>  >>   /*
> >>  >>  @@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
> >>  >>           .nr_max_channels = 8,
> >>  >>           .nr_max_requests = 24,
> >>  >>           .nr_max_vchans = 37,
> >>  >>  + .gate_needed = true,
> >>  >>   };
> >>  >>
> >>  >>   static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
> >>  >>           .nr_max_channels = 8,
> >>  >>           .nr_max_requests = 28,
> >>  >>           .nr_max_vchans = 39,
> >>  >>  + .gate_needed = true,
> >>  >>   };
> >>  >>
> >>  >>   /*
> >>  >>  @@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
> >>  >>           .nr_max_vchans = 34,
> >>  >>   };
> >>  >>
> >>  >>  +static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> >>  >>  + .nr_max_channels = 8,
> >>  >>  + .nr_max_requests = 23,
> >>  >>  + .nr_max_vchans = 24,
> >>  >
> >>  > This one is suspicious. There's just a single endpoint that can be
> >>  > used in both directions?
> >>
> >>  nr_max_vchans is the endpoint number. nr_max_requests is the
> >>  maximum DRQ number, for V3s, according to the datasheet, it's
> >>  23: SPI0_{R,T}X.
> >
> > There's not a lot of endpoints indeed, but you need 28 vchans (2 *
> > 14).
> 
> Sorry but I counted only 12 pairs of vchans:
> Port 0. SRAM
> Port 1. SDRAM
> Port 6. UART0
> Port 7. UART1
> Port 8. UART2
> Port 15. Audio Codec
> Port 16. CE
> Port 17. OTG EP1
> Port 18. OTG EP2
> Port 19. OTG EP3
> Port 20. OTG EP4
> Port 23. SPI0

It seems like I can't count anymore... Yes, you're right, sorry.

Having a comment on top of the structure, just like all the other SoCs
would be nice though.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant
@ 2017-03-01  9:32             ` Maxime Ripard
  0 siblings, 0 replies; 45+ messages in thread
From: Maxime Ripard @ 2017-03-01  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 01, 2017 at 01:58:33AM +0800, Icenowy Zheng wrote:
> 
> 
> 01.03.2017, 01:56, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> > On Mon, Feb 27, 2017 at 06:48:01PM +0800, Icenowy Zheng wrote:
> >> ?27.02.2017, 15:50, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
> >> ?> On Sat, Feb 25, 2017 at 08:30:25PM +0800, Icenowy Zheng wrote:
> >> ?>> ?Allwinner V3s has a DMA engine similar to the ones from A31, but with
> >> ?>> ?fewer channels and DRQs.
> >> ?>>
> >> ?>> ?Add support for it.
> >> ?>>
> >> ?>> ?As it also needs the special gate bit, make the gate bit generic.
> >> ?>
> >> ?> That should be part of a separate patch.
> >>
> >> ?OK.
> >>
> >> ?>
> >> ?>> ?According to BSP source code, SUN8IW6 (A83T) also needs the bit, so it
> >> ?>> ?have also been specified gate_needed property.
> >> ?>>
> >> ?>> ?Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >> ?>> ?---
> >> ?>> ??Documentation/devicetree/bindings/dma/sun6i-dma.txt | 1 +
> >> ?>> ??drivers/dma/sun6i-dma.c | 17 ++++++++++++++---
> >> ?>> ??2 files changed, 15 insertions(+), 3 deletions(-)
> >> ?>>
> >> ?>> ?diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >> ?>> ?index 6b267045f522..98fbe1a5c6dd 100644
> >> ?>> ?--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >> ?>> ?+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
> >> ?>> ?@@ -9,6 +9,7 @@ Required properties:
> >> ?>> ????????????????????"allwinner,sun8i-a23-dma"
> >> ?>> ????????????????????"allwinner,sun8i-a83t-dma"
> >> ?>> ????????????????????"allwinner,sun8i-h3-dma"
> >> ?>> ?+ "allwinner,sun8i-v3s-dma"
> >> ?>> ??- reg: Should contain the registers base address and length
> >> ?>> ??- interrupts: Should contain a reference to the interrupt used by this device
> >> ?>> ??- clocks: Should contain a reference to the parent AHB clock
> >> ?>> ?diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> >> ?>> ?index a2358780ab2c..1f38424c1b14 100644
> >> ?>> ?--- a/drivers/dma/sun6i-dma.c
> >> ?>> ?+++ b/drivers/dma/sun6i-dma.c
> >> ?>> ?@@ -101,6 +101,7 @@ struct sun6i_dma_config {
> >> ?>> ??????????u32 nr_max_channels;
> >> ?>> ??????????u32 nr_max_requests;
> >> ?>> ??????????u32 nr_max_vchans;
> >> ?>> ?+ bool gate_needed;
> >> ?>> ??};
> >> ?>>
> >> ?>> ??/*
> >> ?>> ?@@ -1009,12 +1010,14 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
> >> ?>> ??????????.nr_max_channels = 8,
> >> ?>> ??????????.nr_max_requests = 24,
> >> ?>> ??????????.nr_max_vchans = 37,
> >> ?>> ?+ .gate_needed = true,
> >> ?>> ??};
> >> ?>>
> >> ?>> ??static struct sun6i_dma_config sun8i_a83t_dma_cfg = {
> >> ?>> ??????????.nr_max_channels = 8,
> >> ?>> ??????????.nr_max_requests = 28,
> >> ?>> ??????????.nr_max_vchans = 39,
> >> ?>> ?+ .gate_needed = true,
> >> ?>> ??};
> >> ?>>
> >> ?>> ??/*
> >> ?>> ?@@ -1028,11 +1031,19 @@ static struct sun6i_dma_config sun8i_h3_dma_cfg = {
> >> ?>> ??????????.nr_max_vchans = 34,
> >> ?>> ??};
> >> ?>>
> >> ?>> ?+static struct sun6i_dma_config sun8i_v3s_dma_cfg = {
> >> ?>> ?+ .nr_max_channels = 8,
> >> ?>> ?+ .nr_max_requests = 23,
> >> ?>> ?+ .nr_max_vchans = 24,
> >> ?>
> >> ?> This one is suspicious. There's just a single endpoint that can be
> >> ?> used in both directions?
> >>
> >> ?nr_max_vchans is the endpoint number. nr_max_requests is the
> >> ?maximum DRQ number, for V3s, according to the datasheet, it's
> >> ?23: SPI0_{R,T}X.
> >
> > There's not a lot of endpoints indeed, but you need 28 vchans (2 *
> > 14).
> 
> Sorry but I counted only 12 pairs of vchans:
> Port 0. SRAM
> Port 1. SDRAM
> Port 6. UART0
> Port 7. UART1
> Port 8. UART2
> Port 15. Audio Codec
> Port 16. CE
> Port 17. OTG EP1
> Port 18. OTG EP2
> Port 19. OTG EP3
> Port 20. OTG EP4
> Port 23. SPI0

It seems like I can't count anymore... Yes, you're right, sorry.

Having a comment on top of the structure, just like all the other SoCs
would be nice though.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170301/f0f9eee0/attachment.sig>

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2017-03-01  9:35 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25 12:30 [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock Icenowy Zheng
2017-02-25 12:30 ` Icenowy Zheng
2017-02-25 12:30 ` [PATCH 2/9] ASoC: sun8i-codec-analog: split out linein and mic2 Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-26  6:06   ` Chen-Yu Tsai
2017-02-26  6:06     ` Chen-Yu Tsai
2017-02-26  6:06     ` Chen-Yu Tsai
2017-02-25 12:30 ` [PATCH 3/9] ASoC: sun8i-codec-analog: add support for V3s SoC Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-26  6:16   ` Chen-Yu Tsai
2017-02-26  6:16     ` Chen-Yu Tsai
2017-02-26  6:16     ` Chen-Yu Tsai
2017-02-26  7:08     ` Icenowy Zheng
2017-02-26  7:08       ` Icenowy Zheng
2017-02-25 12:30 ` [PATCH 4/9] ASoC: sun4i-codec: Add support for V3s codec Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-25 12:30 ` [PATCH 5/9] dmaengine: sun6i: support V3s SoC variant Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-27  7:50   ` Maxime Ripard
2017-02-27  7:50     ` Maxime Ripard
2017-02-27  7:50     ` Maxime Ripard
2017-02-27 10:48     ` Icenowy Zheng
2017-02-27 10:48       ` Icenowy Zheng
2017-02-28 17:56       ` Maxime Ripard
2017-02-28 17:56         ` Maxime Ripard
2017-02-28 17:56         ` Maxime Ripard
2017-02-28 17:58         ` Icenowy Zheng
2017-02-28 17:58           ` Icenowy Zheng
2017-03-01  9:32           ` Maxime Ripard
2017-03-01  9:32             ` Maxime Ripard
2017-03-01  9:32             ` Maxime Ripard
2017-02-25 12:30 ` [PATCH 6/9] ARM: dts: sun8i: restore the inclusion of ccu headers in V3s DTSI Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-25 12:30 ` [PATCH 7/9] ARM: dts: sun8i: add DMA engine " Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-25 12:30 ` [PATCH 8/9] ARM: dts: sun8i: add audio codec support into " Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-25 12:30 ` [PATCH 9/9] ARM: dts: sun8i: enable audio on Lichee Pi Zero Dock Icenowy Zheng
2017-02-25 12:30   ` Icenowy Zheng
2017-02-27  7:49 ` [PATCH 1/9] ARM: dts: sun8i: add device tree for Lichee Pi Zero with Dock Maxime Ripard
2017-02-27  7:49   ` Maxime Ripard
2017-02-27  7:49   ` Maxime Ripard
2017-02-28 23:02 ` Rob Herring
2017-02-28 23:02   ` Rob Herring
2017-02-28 23:02   ` Rob Herring

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.