linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec
@ 2016-11-07 10:06 Chen-Yu Tsai
  2016-11-07 10:06 ` [PATCH v3 1/6] ASoC: sun4i-codec: Add support for optional reset control to quirks Chen-Yu Tsai
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

Hi everyone,

This is v3 of my Allwinner A31 audio codec support series. These are
the remaining driver patches not yet merged, with 1 new fix, and the
dts file patches.

The A31's internal codec is similar (in terms of DMA, interface and
control layouts) to the one found in the A10/A13/A20 SoCs. However
it has more external inputs and outputs, the mixer controls are now
stereo (left/right separated), and it also has some audio processing
features (not supported yet).


Changes since v2:

  - Added patch """ASoC: sun4i-codec: Add "Right Mixer" to "Line Out
    Mono Diff." route""" which fixes line out when all the sources
    have their left channel muted.

  - Dropped unused codec_pa_pin from A31 hummingbird dts patch.
    In the past we always provided a pinmux setting for GPIOs used, to
    avoid accidentally muxing a pin that was already used for GPIO, or
    vice versa. The pinctrl subsystem now supports exclusive use of a
    pin for GPIO, which the sunxi platform wants to migrate to. This
    drops the requirement of the explicit pinmux setting for GPIOs.

  - Added Maxime's Acked-by for the two existing patches from v2.


After these are merged I plan to submit patches to support the audio
codec found in Allwinner's A23 and H3 SoCs.


Regards
ChenYu


Chen-Yu Tsai (6):
  ASoC: sun4i-codec: Add support for optional reset control to quirks
  ASoC: sun4i-codec: Add support for A31 ADC capture path
  ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route
  ARM: dts: sun6i: Add audio codec device node
  ARM: dts: sun6i: hummingbird: Enable internal audio codec
  ARM: dts: sun6i: sina31s: Enable internal audio codec

 arch/arm/boot/dts/sun6i-a31-hummingbird.dts | 13 ++++
 arch/arm/boot/dts/sun6i-a31.dtsi            | 13 ++++
 arch/arm/boot/dts/sun6i-a31s-sina31s.dts    |  8 +++
 sound/soc/sunxi/sun4i-codec.c               | 94 ++++++++++++++++++++++++++++-
 4 files changed, 127 insertions(+), 1 deletion(-)

-- 
2.10.2

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

* [PATCH v3 1/6] ASoC: sun4i-codec: Add support for optional reset control to quirks
  2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
@ 2016-11-07 10:06 ` Chen-Yu Tsai
  2016-11-07 10:06 ` [PATCH v3 2/6] ASoC: sun4i-codec: Add support for A31 ADC capture path Chen-Yu Tsai
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

The later Allwinner SoCs have a dedicated reset controller, and
peripherals have dedicated reset controls which need to be deasserted
before the associated peripheral can be used.

Add support for this to the quirks structure and probe/remove functions.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 sound/soc/sunxi/sun4i-codec.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 1934db29b2b5..b28b82a5ec62 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -30,6 +30,7 @@
 #include <linux/of_platform.h>
 #include <linux/clk.h>
 #include <linux/regmap.h>
+#include <linux/reset.h>
 #include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
@@ -217,6 +218,7 @@ struct sun4i_codec {
 	struct regmap	*regmap;
 	struct clk	*clk_apb;
 	struct clk	*clk_module;
+	struct reset_control *rst;
 	struct gpio_desc *gpio_pa;
 
 	/* ADC_FIFOC register is at different offset on different SoCs */
@@ -1167,6 +1169,7 @@ struct sun4i_codec_quirks {
 	struct reg_field reg_adc_fifoc;	/* used for regmap_field */
 	unsigned int reg_dac_txdata;	/* TX FIFO offset for DMA config */
 	unsigned int reg_adc_rxdata;	/* RX FIFO offset for DMA config */
+	bool has_reset;
 };
 
 static const struct sun4i_codec_quirks sun4i_codec_quirks = {
@@ -1262,6 +1265,14 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 		return PTR_ERR(scodec->clk_module);
 	}
 
+	if (quirks->has_reset) {
+		scodec->rst = devm_reset_control_get(&pdev->dev, NULL);
+		if (IS_ERR(scodec->rst)) {
+			dev_err(&pdev->dev, "Failed to get reset control\n");
+			return PTR_ERR(scodec->rst);
+		}
+	};
+
 	scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa",
 						  GPIOD_OUT_LOW);
 	if (IS_ERR(scodec->gpio_pa)) {
@@ -1288,6 +1299,16 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	/* Deassert the reset control */
+	if (scodec->rst) {
+		ret = reset_control_deassert(scodec->rst);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"Failed to deassert the reset control\n");
+			goto err_clk_disable;
+		}
+	}
+
 	/* DMA configuration for TX FIFO */
 	scodec->playback_dma_data.addr = res->start + quirks->reg_dac_txdata;
 	scodec->playback_dma_data.maxburst = 8;
@@ -1302,7 +1323,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 				     &sun4i_codec_dai, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to register our codec\n");
-		goto err_clk_disable;
+		goto err_assert_reset;
 	}
 
 	ret = devm_snd_soc_register_component(&pdev->dev,
@@ -1339,6 +1360,9 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 
 err_unregister_codec:
 	snd_soc_unregister_codec(&pdev->dev);
+err_assert_reset:
+	if (scodec->rst)
+		reset_control_assert(scodec->rst);
 err_clk_disable:
 	clk_disable_unprepare(scodec->clk_apb);
 	return ret;
@@ -1351,6 +1375,8 @@ static int sun4i_codec_remove(struct platform_device *pdev)
 
 	snd_soc_unregister_card(card);
 	snd_soc_unregister_codec(&pdev->dev);
+	if (scodec->rst)
+		reset_control_assert(scodec->rst);
 	clk_disable_unprepare(scodec->clk_apb);
 
 	return 0;
-- 
2.10.2

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

* [PATCH v3 2/6] ASoC: sun4i-codec: Add support for A31 ADC capture path
  2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
  2016-11-07 10:06 ` [PATCH v3 1/6] ASoC: sun4i-codec: Add support for optional reset control to quirks Chen-Yu Tsai
@ 2016-11-07 10:06 ` Chen-Yu Tsai
  2016-11-07 10:07 ` [PATCH v3 3/6] ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route Chen-Yu Tsai
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:06 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

The A31's internal codec capture path has a mixer in front of the ADC
for each channel, capable of selecting various inputs, including
microphones, line in, phone in, and the main output mixer.

This patch adds the various controls, widgets and routes needed for
audio capture from the already supported inputs on the A31.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 sound/soc/sunxi/sun4i-codec.c | 65 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index b28b82a5ec62..6379efd21f00 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -788,6 +788,30 @@ static const struct snd_kcontrol_new sun6i_codec_mixer_controls[] = {
 			SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC2, 1, 0),
 };
 
+/* ADC mixer controls */
+static const struct snd_kcontrol_new sun6i_codec_adc_mixer_controls[] = {
+	SOC_DAPM_DOUBLE("Mixer Capture Switch",
+			SUN6I_CODEC_ADC_ACTL,
+			SUN6I_CODEC_ADC_ACTL_LADCMIX_OMIXL,
+			SUN6I_CODEC_ADC_ACTL_RADCMIX_OMIXR, 1, 0),
+	SOC_DAPM_DOUBLE("Mixer Reversed Capture Switch",
+			SUN6I_CODEC_ADC_ACTL,
+			SUN6I_CODEC_ADC_ACTL_LADCMIX_OMIXR,
+			SUN6I_CODEC_ADC_ACTL_RADCMIX_OMIXL, 1, 0),
+	SOC_DAPM_DOUBLE("Line In Capture Switch",
+			SUN6I_CODEC_ADC_ACTL,
+			SUN6I_CODEC_ADC_ACTL_LADCMIX_LINEINL,
+			SUN6I_CODEC_ADC_ACTL_RADCMIX_LINEINR, 1, 0),
+	SOC_DAPM_DOUBLE("Mic1 Capture Switch",
+			SUN6I_CODEC_ADC_ACTL,
+			SUN6I_CODEC_ADC_ACTL_LADCMIX_MIC1,
+			SUN6I_CODEC_ADC_ACTL_RADCMIX_MIC1, 1, 0),
+	SOC_DAPM_DOUBLE("Mic2 Capture Switch",
+			SUN6I_CODEC_ADC_ACTL,
+			SUN6I_CODEC_ADC_ACTL_LADCMIX_MIC2,
+			SUN6I_CODEC_ADC_ACTL_RADCMIX_MIC2, 1, 0),
+};
+
 /* headphone controls */
 static const char * const sun6i_codec_hp_src_enum_text[] = {
 	"DAC", "Mixer",
@@ -887,6 +911,10 @@ static const struct snd_kcontrol_new sun6i_codec_codec_widgets[] = {
 	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN6I_CODEC_MIC_CTRL,
 		       SUN6I_CODEC_MIC_CTRL_MIC2BOOST, 0x7, 0,
 		       sun6i_codec_mic_gain_scale),
+	SOC_DOUBLE_TLV("ADC Capture Volume",
+		       SUN6I_CODEC_ADC_ACTL, SUN6I_CODEC_ADC_ACTL_ADCLG,
+		       SUN6I_CODEC_ADC_ACTL_ADCRG, 0x7, 0,
+		       sun6i_codec_out_mixer_pregain_scale),
 };
 
 static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
@@ -912,6 +940,23 @@ static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
 	/* Line In */
 	SND_SOC_DAPM_INPUT("LINEIN"),
 
+	/* Digital parts of the ADCs */
+	SND_SOC_DAPM_SUPPLY("ADC Enable", SUN6I_CODEC_ADC_FIFOC,
+			    SUN6I_CODEC_ADC_FIFOC_EN_AD, 0,
+			    NULL, 0),
+
+	/* Analog parts of the ADCs */
+	SND_SOC_DAPM_ADC("Left ADC", "Codec Capture", SUN6I_CODEC_ADC_ACTL,
+			 SUN6I_CODEC_ADC_ACTL_ADCLEN, 0),
+	SND_SOC_DAPM_ADC("Right ADC", "Codec Capture", SUN6I_CODEC_ADC_ACTL,
+			 SUN6I_CODEC_ADC_ACTL_ADCREN, 0),
+
+	/* ADC Mixers */
+	SOC_MIXER_ARRAY("Left ADC Mixer", SND_SOC_NOPM, 0, 0,
+			sun6i_codec_adc_mixer_controls),
+	SOC_MIXER_ARRAY("Right ADC Mixer", SND_SOC_NOPM, 0, 0,
+			sun6i_codec_adc_mixer_controls),
+
 	/* Digital parts of the DACs */
 	SND_SOC_DAPM_SUPPLY("DAC Enable", SUN4I_CODEC_DAC_DPC,
 			    SUN4I_CODEC_DAC_DPC_EN_DA, 0,
@@ -975,6 +1020,20 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
 	{ "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" },
+
 	/* Headphone Routes */
 	{ "Headphone Source Playback Route", "DAC", "Left DAC" },
 	{ "Headphone Source Playback Route", "DAC", "Right DAC" },
@@ -989,6 +1048,12 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
 	{ "Line Out Source Playback Route", "Stereo", "Right Mixer" },
 	{ "Line Out Source Playback Route", "Mono Differential", "Left Mixer" },
 	{ "LINEOUT", NULL, "Line Out Source Playback Route" },
+
+	/* ADC Routes */
+	{ "Left ADC", NULL, "ADC Enable" },
+	{ "Right ADC", NULL, "ADC Enable" },
+	{ "Left ADC", NULL, "Left ADC Mixer" },
+	{ "Right ADC", NULL, "Right ADC Mixer" },
 };
 
 static struct snd_soc_codec_driver sun6i_codec_codec = {
-- 
2.10.2

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

* [PATCH v3 3/6] ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route
  2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
  2016-11-07 10:06 ` [PATCH v3 1/6] ASoC: sun4i-codec: Add support for optional reset control to quirks Chen-Yu Tsai
  2016-11-07 10:06 ` [PATCH v3 2/6] ASoC: sun4i-codec: Add support for A31 ADC capture path Chen-Yu Tsai
@ 2016-11-07 10:07 ` Chen-Yu Tsai
  2017-01-09 20:01   ` Applied "ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route" to the asoc tree Mark Brown
  2016-11-07 10:07 ` [PATCH v3 4/6] ARM: dts: sun6i: Add audio codec device node Chen-Yu Tsai
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

The mono differential output for "Line Out" downmixes the stereo audio
from the mixer, instead of just taking the left channel.

Add a route from the "Right Mixer" to "Line Out Source Playback Route"
through the "Mono Differential" path, so DAPM doesn't shut down
everything if the left channel is muted.

Fixes: 0f909f98d7cb ("ASoC: sun4i-codec: Add support for A31 Line Out
		      playback")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 sound/soc/sunxi/sun4i-codec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 6379efd21f00..006ca3c17e80 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1047,6 +1047,7 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
 	{ "Line Out Source Playback Route", "Stereo", "Left Mixer" },
 	{ "Line Out Source Playback Route", "Stereo", "Right Mixer" },
 	{ "Line Out Source Playback Route", "Mono Differential", "Left Mixer" },
+	{ "Line Out Source Playback Route", "Mono Differential", "Right Mixer" },
 	{ "LINEOUT", NULL, "Line Out Source Playback Route" },
 
 	/* ADC Routes */
-- 
2.10.2

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

* [PATCH v3 4/6] ARM: dts: sun6i: Add audio codec device node
  2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2016-11-07 10:07 ` [PATCH v3 3/6] ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route Chen-Yu Tsai
@ 2016-11-07 10:07 ` Chen-Yu Tsai
  2016-11-07 18:28   ` Maxime Ripard
  2016-11-07 10:07 ` [PATCH v3 5/6] ARM: dts: sun6i: hummingbird: Enable internal audio codec Chen-Yu Tsai
  2016-11-07 10:07 ` [PATCH v3 6/6] ARM: dts: sun6i: sina31s: " Chen-Yu Tsai
  5 siblings, 1 reply; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

The A31 SoC includes the Allwinner audio codec, capable of 24-bit
playback up to 192 kHz and 24-bit capture up to 48 kHz.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun6i-a31.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 2e8bf93dcfb2..f68e6102b01b 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -784,6 +784,19 @@
 			reset-names = "ahb";
 		};
 
+		codec: codec@01c22c00 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun6i-a31-codec";
+			reg = <0x01c22c00 0x98>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_APB1_CODEC>, <&ccu CLK_CODEC>;
+			clock-names = "apb", "codec";
+			resets = <&ccu RST_APB1_CODEC>;
+			dmas = <&dma 15>, <&dma 15>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
 		timer@01c60000 {
 			compatible = "allwinner,sun6i-a31-hstimer",
 				     "allwinner,sun7i-a20-hstimer";
-- 
2.10.2

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

* [PATCH v3 5/6] ARM: dts: sun6i: hummingbird: Enable internal audio codec
  2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
                   ` (3 preceding siblings ...)
  2016-11-07 10:07 ` [PATCH v3 4/6] ARM: dts: sun6i: Add audio codec device node Chen-Yu Tsai
@ 2016-11-07 10:07 ` Chen-Yu Tsai
  2016-11-07 18:29   ` Maxime Ripard
  2016-11-07 10:07 ` [PATCH v3 6/6] ARM: dts: sun6i: sina31s: " Chen-Yu Tsai
  5 siblings, 1 reply; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

The Hummingbird A31 has headset and line in audio jacks and an onboard
mic routed to the pins for the SoC's internal codec. The line out pins
are routed to an onboard speaker amp, whose output is available on a
pin header.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun6i-a31-hummingbird.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
index 9a74637f677f..4e0516026596 100644
--- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
+++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
@@ -69,6 +69,19 @@
 	};
 };
 
+&codec {
+	allwinner,audio-routing =
+		"Headphone", "HP",
+		"Speaker", "LINEOUT",
+		"LINEIN", "Line In",
+		"MIC1", "Mic",
+		"MIC2", "Headset Mic",
+		"Mic",	"MBIAS",
+		"Headset Mic", "HBIAS";
+	allwinner,pa-gpios = <&pio 7 22 GPIO_ACTIVE_HIGH>; /* PH22 */
+	status = "okay";
+};
+
 &cpu0 {
 	cpu-supply = <&reg_dcdc3>;
 };
-- 
2.10.2

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

* [PATCH v3 6/6] ARM: dts: sun6i: sina31s: Enable internal audio codec
  2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
                   ` (4 preceding siblings ...)
  2016-11-07 10:07 ` [PATCH v3 5/6] ARM: dts: sun6i: hummingbird: Enable internal audio codec Chen-Yu Tsai
@ 2016-11-07 10:07 ` Chen-Yu Tsai
  2016-11-07 18:29   ` Maxime Ripard
  5 siblings, 1 reply; 11+ messages in thread
From: Chen-Yu Tsai @ 2016-11-07 10:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Maxime Ripard
  Cc: Chen-Yu Tsai, alsa-devel, linux-arm-kernel, linux-kernel,
	devicetree, linux-sunxi

The SinA31s routes the SoC's LINEOUT pins to a line out jack, and MIC1
to a microphone jack, with MBIAS providing phantom power.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun6i-a31s-sina31s.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun6i-a31s-sina31s.dts b/arch/arm/boot/dts/sun6i-a31s-sina31s.dts
index 6ead2f5c847a..c35ec112f5a0 100644
--- a/arch/arm/boot/dts/sun6i-a31s-sina31s.dts
+++ b/arch/arm/boot/dts/sun6i-a31s-sina31s.dts
@@ -65,6 +65,14 @@
 	};
 };
 
+&codec {
+	allwinner,audio-routing =
+		"Line Out", "LINEOUT",
+		"MIC1", "Mic",
+		"Mic",	"MBIAS";
+	status = "okay";
+};
+
 &ehci0 {
 	/* USB 2.0 4 port hub IC */
 	status = "okay";
-- 
2.10.2

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

* Re: [PATCH v3 4/6] ARM: dts: sun6i: Add audio codec device node
  2016-11-07 10:07 ` [PATCH v3 4/6] ARM: dts: sun6i: Add audio codec device node Chen-Yu Tsai
@ 2016-11-07 18:28   ` Maxime Ripard
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2016-11-07 18:28 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-arm-kernel, linux-kernel, devicetree,
	linux-sunxi

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

On Mon, Nov 07, 2016 at 06:07:01PM +0800, Chen-Yu Tsai wrote:
> The A31 SoC includes the Allwinner audio codec, capable of 24-bit
> playback up to 192 kHz and 24-bit capture up to 48 kHz.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  arch/arm/boot/dts/sun6i-a31.dtsi | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
> index 2e8bf93dcfb2..f68e6102b01b 100644
> --- a/arch/arm/boot/dts/sun6i-a31.dtsi
> +++ b/arch/arm/boot/dts/sun6i-a31.dtsi
> @@ -784,6 +784,19 @@
>  			reset-names = "ahb";
>  		};
>  
> +		codec: codec@01c22c00 {
> +			#sound-dai-cells = <0>;
> +			compatible = "allwinner,sun6i-a31-codec";
> +			reg = <0x01c22c00 0x98>;

The memory mapped region is 0x400. I fixed this and applied.

Thanks!
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] 11+ messages in thread

* Re: [PATCH v3 5/6] ARM: dts: sun6i: hummingbird: Enable internal audio codec
  2016-11-07 10:07 ` [PATCH v3 5/6] ARM: dts: sun6i: hummingbird: Enable internal audio codec Chen-Yu Tsai
@ 2016-11-07 18:29   ` Maxime Ripard
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2016-11-07 18:29 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-arm-kernel, linux-kernel, devicetree,
	linux-sunxi

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

On Mon, Nov 07, 2016 at 06:07:02PM +0800, Chen-Yu Tsai wrote:
> The Hummingbird A31 has headset and line in audio jacks and an onboard
> mic routed to the pins for the SoC's internal codec. The line out pins
> are routed to an onboard speaker amp, whose output is available on a
> pin header.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Applied, thanks!
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] 11+ messages in thread

* Re: [PATCH v3 6/6] ARM: dts: sun6i: sina31s: Enable internal audio codec
  2016-11-07 10:07 ` [PATCH v3 6/6] ARM: dts: sun6i: sina31s: " Chen-Yu Tsai
@ 2016-11-07 18:29   ` Maxime Ripard
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2016-11-07 18:29 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-arm-kernel, linux-kernel, devicetree,
	linux-sunxi

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

On Mon, Nov 07, 2016 at 06:07:03PM +0800, Chen-Yu Tsai wrote:
> The SinA31s routes the SoC's LINEOUT pins to a line out jack, and MIC1
> to a microphone jack, with MBIAS providing phantom power.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Applied, thanks!
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] 11+ messages in thread

* Applied "ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route" to the asoc tree
  2016-11-07 10:07 ` [PATCH v3 3/6] ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route Chen-Yu Tsai
@ 2017-01-09 20:01   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2017-01-09 20:01 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Mark Brown, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Maxime Ripard, devicetree,
	alsa-devel, linux-sunxi, linux-kernel, linux-arm-kernel

The patch

   ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 19426bdedb72b965db0ebf2106e95e9eeb3b5935 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Sun, 8 Jan 2017 02:57:06 +0800
Subject: [PATCH] ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff."
 route

The mono differential output for "Line Out" downmixes the stereo audio
from the mixer, instead of just taking the left channel.

Add a route from the "Right Mixer" to "Line Out Source Playback Route"
through the "Mono Differential" path, so DAPM doesn't shut down
everything if the left channel is muted.

Fixes: 0f909f98d7cb ("ASoC: sun4i-codec: Add support for A31 Line Out
		      playback")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sunxi/sun4i-codec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 848af01692a0..c3aab10fa085 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1058,6 +1058,7 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
 	{ "Line Out Source Playback Route", "Stereo", "Left Mixer" },
 	{ "Line Out Source Playback Route", "Stereo", "Right Mixer" },
 	{ "Line Out Source Playback Route", "Mono Differential", "Left Mixer" },
+	{ "Line Out Source Playback Route", "Mono Differential", "Right Mixer" },
 	{ "LINEOUT", NULL, "Line Out Source Playback Route" },
 
 	/* ADC Routes */
-- 
2.11.0

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

end of thread, other threads:[~2017-01-09 20:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 10:06 [PATCH v3 0/6] ASoC: sun4i-codec: Add support for A31 Codec Chen-Yu Tsai
2016-11-07 10:06 ` [PATCH v3 1/6] ASoC: sun4i-codec: Add support for optional reset control to quirks Chen-Yu Tsai
2016-11-07 10:06 ` [PATCH v3 2/6] ASoC: sun4i-codec: Add support for A31 ADC capture path Chen-Yu Tsai
2016-11-07 10:07 ` [PATCH v3 3/6] ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route Chen-Yu Tsai
2017-01-09 20:01   ` Applied "ASoC: sun4i-codec: Add "Right Mixer" to "Line Out Mono Diff." route" to the asoc tree Mark Brown
2016-11-07 10:07 ` [PATCH v3 4/6] ARM: dts: sun6i: Add audio codec device node Chen-Yu Tsai
2016-11-07 18:28   ` Maxime Ripard
2016-11-07 10:07 ` [PATCH v3 5/6] ARM: dts: sun6i: hummingbird: Enable internal audio codec Chen-Yu Tsai
2016-11-07 18:29   ` Maxime Ripard
2016-11-07 10:07 ` [PATCH v3 6/6] ARM: dts: sun6i: sina31s: " Chen-Yu Tsai
2016-11-07 18:29   ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).