[linux-sunxi] Re: [PATCH v2 06/14] ASoC: sun4i-codec: Add support for A31 playback through headphone output

2016-11-03 Thread Chen-Yu Tsai
On Fri, Nov 4, 2016 at 1:36 AM, Maxime Ripard
 wrote:
> Hi,
>
> On Thu, Nov 03, 2016 at 03:55:48PM +0800, Chen-Yu Tsai wrote:
>> +/* headphone controls */
>> +static const char * const sun6i_codec_hp_src_enum_text[] = {
>> + "DAC", "Mixer",
>> +};
>> +
>> +static SOC_ENUM_DOUBLE_DECL(sun6i_codec_hp_src_enum,
>> + SUN6I_CODEC_OM_DACA_CTRL,
>> + SUN6I_CODEC_OM_DACA_CTRL_LHPIS,
>> + SUN6I_CODEC_OM_DACA_CTRL_RHPIS,
>> + sun6i_codec_hp_src_enum_text);
>> +
>> +static const struct snd_kcontrol_new sun6i_codec_hp_src[] = {
>> + SOC_DAPM_ENUM("Headphone Source Playback Route",
>> +   sun6i_codec_hp_src_enum),
>> +};
>
> What is that route exactly? A muxer?

Yup. The following is part of the widgets list later in the code:

+   /* Headphone output path */
+   SND_SOC_DAPM_MUX("Headphone Source Playback Route",
+SND_SOC_NOPM, 0, 0, sun6i_codec_hp_src),

ChenYu

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Applied "ASoC: sun4i-codec: Increase DMA max burst to 8" to the asoc tree

2016-11-03 Thread Mark Brown
The patch

   ASoC: sun4i-codec: Increase DMA max burst to 8

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 730e2dd0cbc7a7ec10174d9d291cdd8e8082a948 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai 
Date: Thu, 3 Nov 2016 15:55:46 +0800
Subject: [PATCH] ASoC: sun4i-codec: Increase DMA max burst to 8

According to the DMA engine API documentation, maxburst denotes the
largest possible size of a single transfer, so as not to overflow
destination FIFOs as explained in this excerpt from dmaengine.h

 * @src_maxburst: the maximum number of words (note: words, as in
 * units of the src_addr_width member, not bytes) that can be sent
 * in one burst to the device. Typically something like half the
 * FIFO depth on I/O peripherals so you don't overflow it. This
 * may or may not be applicable on memory sources.
 * @dst_maxburst: same as src_maxburst but for destination target
 * mutatis mutandis.

The TX FIFO is 64 samples deep for stereo, and the RX FIFO is 16
samples deep. So maxburst could be 32 and 8 for TX and RX respectively.

Unfortunately the sunxi DMA controller driver takes maxburst as
the requested burst size, rather than a limit, and returns an error
for unsupported values. The original value was 4, but some later
SoCs do not officially support this burst size.

This patch increases maxburst on the TX side to 8, which is supported
by all variants of the sunxi DMA controller.

Signed-off-by: Chen-Yu Tsai 
Acked-by: Maxime Ripard 
Signed-off-by: Mark Brown 
---
 sound/soc/sunxi/sun4i-codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 61ae502a5061..d867b96d367b 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -886,12 +886,12 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 
/* DMA configuration for TX FIFO */
scodec->playback_dma_data.addr = res->start + quirks->reg_dac_txdata;
-   scodec->playback_dma_data.maxburst = 4;
+   scodec->playback_dma_data.maxburst = 8;
scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 
/* DMA configuration for RX FIFO */
scodec->capture_dma_data.addr = res->start + quirks->reg_adc_rxdata;
-   scodec->capture_dma_data.maxburst = 4;
+   scodec->capture_dma_data.maxburst = 8;
scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 
ret = snd_soc_register_codec(>dev, quirks->codec,
-- 
2.10.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Applied "ASoC: sun4i-codec: Expand quirks to handle register offsets and card creation" to the asoc tree

2016-11-03 Thread Mark Brown
The patch

   ASoC: sun4i-codec: Expand quirks to handle register offsets and card creation

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 bc03f0d576000739694ed95e89c71cda78964224 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai 
Date: Thu, 3 Nov 2016 15:55:44 +0800
Subject: [PATCH] ASoC: sun4i-codec: Expand quirks to handle register offsets
 and card creation

The A31 has a similar codec to the A10/A20. The PCM parts are very
similar, with just different register offsets. The analog paths are
very different. There are more inputs and outputs.

The A31s, A23, and H3 have a similar PCM interface, again with register
offsets slightly rearranged. The analog path controls, while very
similar between them and the A31, have been moved a separate bus which
is accessed through a message box like interface in the PRCM address
range. This would be handled by a separate auxiliary device tied in
through the device tree in its supporting create_card function.

The quirks structure is expanded to include different register offsets
and separate callbacks for creating the ASoC card. The regmap_config,
quirks, and of_device_match tables have been moved to facilitate this.

Signed-off-by: Chen-Yu Tsai 
Acked-by: Maxime Ripard 
Signed-off-by: Mark Brown 
---
 sound/soc/sunxi/sun4i-codec.c | 87 +--
 1 file changed, 60 insertions(+), 27 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 5ff071fd4996..61ae502a5061 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -3,6 +3,7 @@
  * Copyright 2014 Jon Smirl 
  * Copyright 2015 Maxime Ripard 
  * Copyright 2015 Adam Sampson 
+ * Copyright 2016 Chen-Yu Tsai 
  *
  * Based on the Allwinner SDK driver, released under the GPL.
  *
@@ -24,8 +25,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -114,6 +116,9 @@ struct sun4i_codec {
struct clk  *clk_module;
struct gpio_desc *gpio_pa;
 
+   /* ADC_FIFOC register is at different offset on different SoCs */
+   struct regmap_field *reg_adc_fifoc;
+
struct snd_dmaengine_dai_dma_data   capture_dma_data;
struct snd_dmaengine_dai_dma_data   playback_dma_data;
 };
@@ -142,16 +147,16 @@ static void sun4i_codec_stop_playback(struct sun4i_codec 
*scodec)
 static void sun4i_codec_start_capture(struct sun4i_codec *scodec)
 {
/* Enable ADC DRQ */
-   regmap_update_bits(scodec->regmap, SUN4I_CODEC_ADC_FIFOC,
-  BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN),
-  BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN));
+   regmap_field_update_bits(scodec->reg_adc_fifoc,
+BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN),
+BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN));
 }
 
 static void sun4i_codec_stop_capture(struct sun4i_codec *scodec)
 {
/* Disable ADC DRQ */
-   regmap_update_bits(scodec->regmap, SUN4I_CODEC_ADC_FIFOC,
-  BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0);
+   regmap_field_update_bits(scodec->reg_adc_fifoc,
+BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0);
 }
 
 static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd,
@@ -194,15 +199,15 @@ static int sun4i_codec_prepare_capture(struct 
snd_pcm_substream *substream,
 
 
/* Flush RX FIFO */
-   regmap_update_bits(scodec->regmap, SUN4I_CODEC_ADC_FIFOC,
-  BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH),
-  BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH));
+   regmap_field_update_bits(scodec->reg_adc_fifoc,
+BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH),
+BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH));
 
 
/* Set RX FIFO trigger level */
-   regmap_update_bits(scodec->regmap, SUN4I_CODEC_ADC_FIFOC,
- 

[linux-sunxi] Applied "ASoC: sun4i-codec: Add support for A31 playback through headphone output" to the asoc tree

2016-11-03 Thread Mark Brown
The patch

   ASoC: sun4i-codec: Add support for A31 playback through headphone output

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 8d9e4c9e993f34e7f74bf36f417920a01a42c4b0 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai 
Date: Thu, 3 Nov 2016 15:55:48 +0800
Subject: [PATCH] ASoC: sun4i-codec: Add support for A31 playback through
 headphone output

The A31 has a similar codec to the A10/A20. The PCM parts are very
similar, with different register offsets. The analog paths are very
different. There are more inputs and outputs. The ADC mux has been
replaced with a proper mixer.

This patch adds support for the basic playback path of the A31 codec,
from the DAC to the headphones. Headphone detection, microphone,
signaling, other inputs/outputs and capture will be added later.

Signed-off-by: Chen-Yu Tsai 
Acked-by: Maxime Ripard 
Signed-off-by: Mark Brown 
---
 .../devicetree/bindings/sound/sun4i-codec.txt  |  22 +-
 sound/soc/sunxi/sun4i-codec.c  | 271 -
 2 files changed, 287 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt 
b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
index 0dce690f78f5..bf480e9683a3 100644
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
@@ -1,8 +1,10 @@
 * Allwinner A10 Codec
 
 Required properties:
-- compatible: must be either "allwinner,sun4i-a10-codec" or
-  "allwinner,sun7i-a20-codec"
+- compatible: must be one of the following compatibles:
+   - "allwinner,sun4i-a10-codec"
+   - "allwinner,sun6i-a31-codec"
+   - "allwinner,sun7i-a20-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,
@@ -17,6 +19,10 @@ Required properties:
 Optional properties:
 - allwinner,pa-gpios: gpio to enable external amplifier
 
+Required properties for the following compatibles:
+   - "allwinner,sun6i-a31-codec"
+- resets: phandle to the reset control for this device
+
 Example:
 codec: codec@01c22c00 {
#sound-dai-cells = <0>;
@@ -28,3 +34,15 @@ codec: codec@01c22c00 {
dmas = < 0 19>, < 0 19>;
dma-names = "rx", "tx";
 };
+
+codec: codec@01c22c00 {
+   #sound-dai-cells = <0>;
+   compatible = "allwinner,sun6i-a31-codec";
+   reg = <0x01c22c00 0x98>;
+   interrupts = ;
+   clocks = < CLK_APB1_CODEC>, < CLK_CODEC>;
+   clock-names = "apb", "codec";
+   resets = < RST_APB1_CODEC>;
+   dmas = < 15>, < 15>;
+   dma-names = "rx", "tx";
+};
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index d867b96d367b..d4b2186b5d84 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -109,6 +109,109 @@
 /* Microphone controls (sun7i only) */
 #define SUN7I_CODEC_AC_MIC_PHONE_CAL   (0x3c)
 
+/*
+ * sun6i specific registers
+ *
+ * sun6i shares the same digital control and FIFO registers as sun4i,
+ * but only the DAC digital controls are at the same offset. The others
+ * have been moved around to accommodate extra analog controls.
+ */
+
+/* Codec DAC digital controls and FIFO registers */
+#define SUN6I_CODEC_ADC_FIFOC  (0x10)
+#define SUN6I_CODEC_ADC_FIFOC_EN_AD(28)
+#define SUN6I_CODEC_ADC_FIFOS  (0x14)
+#define SUN6I_CODEC_ADC_RXDATA (0x18)
+
+/* Output mixer and gain controls */
+#define SUN6I_CODEC_OM_DACA_CTRL   (0x20)
+#define SUN6I_CODEC_OM_DACA_CTRL_DACAREN   (31)
+#define SUN6I_CODEC_OM_DACA_CTRL_DACALEN   (30)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIXEN(29)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIXEN(28)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC1 (23)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC2 (22)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_PHONE(21)
+#define 

[linux-sunxi] Applied "ASoC: sun4i-codec: Add support for A31 Line In playback" to the asoc tree

2016-11-03 Thread Mark Brown
The patch

   ASoC: sun4i-codec: Add support for A31 Line In playback

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 dff5051250674fce575fa36c22b2f007363e42d0 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai 
Date: Thu, 3 Nov 2016 15:55:49 +0800
Subject: [PATCH] ASoC: sun4i-codec: Add support for A31 Line In playback

The A31 integrated codec has a stereo "Line In" input. Add support for
it to the playback paths.

Signed-off-by: Chen-Yu Tsai 
Acked-by: Maxime Ripard 
Signed-off-by: Mark Brown 
---
 sound/soc/sunxi/sun4i-codec.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index d4b2186b5d84..72a84f76aa57 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -772,6 +772,10 @@ static const struct snd_kcontrol_new 
sun6i_codec_mixer_controls[] = {
SUN6I_CODEC_OM_DACA_CTRL,
SUN6I_CODEC_OM_DACA_CTRL_LMIX_DACR,
SUN6I_CODEC_OM_DACA_CTRL_RMIX_DACL, 1, 0),
+   SOC_DAPM_DOUBLE("Line In Playback Switch",
+   SUN6I_CODEC_OM_DACA_CTRL,
+   SUN6I_CODEC_OM_DACA_CTRL_LMIX_LINEINL,
+   SUN6I_CODEC_OM_DACA_CTRL_RMIX_LINEINR, 1, 0),
 };
 
 /* headphone controls */
@@ -793,6 +797,8 @@ static const struct snd_kcontrol_new sun6i_codec_hp_src[] = 
{
 /* volume / mute controls */
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_dvol_scale, -7308, 116, 0);
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_hp_vol_scale, -6300, 100, 1);
+static const DECLARE_TLV_DB_SCALE(sun6i_codec_out_mixer_pregain_scale,
+ -450, 150, 0);
 
 static const struct snd_kcontrol_new sun6i_codec_codec_widgets[] = {
SOC_SINGLE_TLV("DAC Playback Volume", SUN4I_CODEC_DAC_DPC,
@@ -806,9 +812,16 @@ static const struct snd_kcontrol_new 
sun6i_codec_codec_widgets[] = {
   SUN6I_CODEC_OM_DACA_CTRL,
   SUN6I_CODEC_OM_DACA_CTRL_LHPPAMUTE,
   SUN6I_CODEC_OM_DACA_CTRL_RHPPAMUTE, 1, 0),
+   /* Mixer pre-gains */
+   SOC_SINGLE_TLV("Line In Playback Volume",
+  SUN6I_CODEC_OM_PA_CTRL, SUN6I_CODEC_OM_PA_CTRL_LINEING,
+  0x7, 0, sun6i_codec_out_mixer_pregain_scale),
 };
 
 static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
+   /* Line In */
+   SND_SOC_DAPM_INPUT("LINEIN"),
+
/* Digital parts of the DACs */
SND_SOC_DAPM_SUPPLY("DAC Enable", SUN4I_CODEC_DAC_DPC,
SUN4I_CODEC_DAC_DPC_EN_DA, 0,
@@ -850,10 +863,12 @@ static const struct snd_soc_dapm_route 
sun6i_codec_codec_dapm_routes[] = {
/* 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" },
 
/* 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" },
 
/* Headphone Routes */
{ "Headphone Source Playback Route", "DAC", "Left DAC" },
-- 
2.10.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Applied "ASoC: sun4i-codec: Revise comments for register definition macros" to the asoc tree

2016-11-03 Thread Mark Brown
The patch

   ASoC: sun4i-codec: Revise comments for register definition macros

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 bd720ecf4ec6923207b4059ff4b4a43ee25ac891 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai 
Date: Thu, 3 Nov 2016 15:55:45 +0800
Subject: [PATCH] ASoC: sun4i-codec: Revise comments for register definition
 macros

This revises existing comments in the register definition macros
section, and adds a few more, so that readers can clearly identify
the types of control registers.

Signed-off-by: Chen-Yu Tsai 
Acked-by: Maxime Ripard 
Signed-off-by: Mark Brown 
---
 sound/soc/sunxi/sun4i-codec.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 7b78f4045d38..969d86b4cd44 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-/* Codec DAC register offsets and bit fields */
+/* Codec DAC digital controls and FIFO registers */
 #define SUN4I_CODEC_DAC_DPC(0x00)
 #define SUN4I_CODEC_DAC_DPC_EN_DA  (31)
 #define SUN4I_CODEC_DAC_DPC_DVOL   (12)
@@ -55,6 +55,8 @@
 #define SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH   (0)
 #define SUN4I_CODEC_DAC_FIFOS  (0x08)
 #define SUN4I_CODEC_DAC_TXDATA (0x0c)
+
+/* Codec DAC side analog signal controls */
 #define SUN4I_CODEC_DAC_ACTL   (0x10)
 #define SUN4I_CODEC_DAC_ACTL_DACAENR   (31)
 #define SUN4I_CODEC_DAC_ACTL_DACAENL   (30)
@@ -69,7 +71,7 @@
 #define SUN4I_CODEC_DAC_TUNE   (0x14)
 #define SUN4I_CODEC_DAC_DEBUG  (0x18)
 
-/* Codec ADC register offsets and bit fields */
+/* Codec ADC digital controls and FIFO registers */
 #define SUN4I_CODEC_ADC_FIFOC  (0x1c)
 #define SUN4I_CODEC_ADC_FIFOC_ADC_FS   (29)
 #define SUN4I_CODEC_ADC_FIFOC_EN_AD(28)
@@ -81,6 +83,8 @@
 #define SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH   (0)
 #define SUN4I_CODEC_ADC_FIFOS  (0x20)
 #define SUN4I_CODEC_ADC_RXDATA (0x24)
+
+/* Codec ADC side analog signal controls */
 #define SUN4I_CODEC_ADC_ACTL   (0x28)
 #define SUN4I_CODEC_ADC_ACTL_ADC_R_EN  (31)
 #define SUN4I_CODEC_ADC_ACTL_ADC_L_EN  (30)
@@ -93,10 +97,14 @@
 #define SUN4I_CODEC_ADC_ACTL_DDE   (3)
 #define SUN4I_CODEC_ADC_DEBUG  (0x2c)
 
-/* Other various ADC registers */
+/* FIFO counters */
 #define SUN4I_CODEC_DAC_TXCNT  (0x30)
 #define SUN4I_CODEC_ADC_RXCNT  (0x34)
+
+/* Calibration register (sun7i only) */
 #define SUN7I_CODEC_AC_DAC_CAL (0x38)
+
+/* Microphone controls (sun7i only) */
 #define SUN7I_CODEC_AC_MIC_PHONE_CAL   (0x3c)
 
 struct sun4i_codec {
-- 
2.10.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v2 06/14] ASoC: sun4i-codec: Add support for A31 playback through headphone output

2016-11-03 Thread Maxime Ripard
Hi,

On Thu, Nov 03, 2016 at 03:55:48PM +0800, Chen-Yu Tsai wrote:
> +/* headphone controls */
> +static const char * const sun6i_codec_hp_src_enum_text[] = {
> + "DAC", "Mixer",
> +};
> +
> +static SOC_ENUM_DOUBLE_DECL(sun6i_codec_hp_src_enum,
> + SUN6I_CODEC_OM_DACA_CTRL,
> + SUN6I_CODEC_OM_DACA_CTRL_LHPIS,
> + SUN6I_CODEC_OM_DACA_CTRL_RHPIS,
> + sun6i_codec_hp_src_enum_text);
> +
> +static const struct snd_kcontrol_new sun6i_codec_hp_src[] = {
> + SOC_DAPM_ENUM("Headphone Source Playback Route",
> +   sun6i_codec_hp_src_enum),
> +};

What is that route exactly? A muxer?

Thanks,
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 02/14] ASoC: sun4i-codec: Expand quirks to handle register offsets and card creation

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:44PM +0800, Chen-Yu Tsai wrote:
> The A31 has a similar codec to the A10/A20. The PCM parts are very
> similar, with just different register offsets. The analog paths are
> very different. There are more inputs and outputs.
> 
> The A31s, A23, and H3 have a similar PCM interface, again with register
> offsets slightly rearranged. The analog path controls, while very
> similar between them and the A31, have been moved a separate bus which
> is accessed through a message box like interface in the PRCM address
> range. This would be handled by a separate auxiliary device tied in
> through the device tree in its supporting create_card function.
> 
> The quirks structure is expanded to include different register offsets
> and separate callbacks for creating the ASoC card. The regmap_config,
> quirks, and of_device_match tables have been moved to facilitate this.
> 
> Signed-off-by: Chen-Yu Tsai 

Acked-by: Maxime Ripard 

Thanks!
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Applied "ASoC: sun4i-codec: Move data structures to add create_card call to quirks" to the asoc tree

2016-11-03 Thread Mark Brown
The patch

   ASoC: sun4i-codec: Move data structures to add create_card call to quirks

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 2f2a3462bc15e9613412ca186bf8a6611afa66c7 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai 
Date: Thu, 3 Nov 2016 15:55:43 +0800
Subject: [PATCH] ASoC: sun4i-codec: Move data structures to add create_card
 call to quirks

The audio codec on later Allwinner SoCs have a different layout and
audio path compared to the A10/A20. However the PCM parts are still
the same.

The different layout and audio paths mean we need a different
create_card function for different families, so they can create
DAPM endpoint widgets and routes.

This patch moves the regmap configs, quirks and of_device_id
structures to just before the probe function, so we can, among other
things, include a pointer for the create_card function. None of the
lines of code were changed.

Signed-off-by: Chen-Yu Tsai 
Acked-by: Maxime Ripard 
Signed-off-by: Mark Brown 
---
 sound/soc/sunxi/sun4i-codec.c | 78 +--
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index a60707761abf..7b78f4045d38 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -678,45 +678,6 @@ static struct snd_soc_dai_driver dummy_cpu_dai = {
 },
 };
 
-static const struct regmap_config sun4i_codec_regmap_config = {
-   .reg_bits   = 32,
-   .reg_stride = 4,
-   .val_bits   = 32,
-   .max_register   = SUN4I_CODEC_ADC_RXCNT,
-};
-
-static const struct regmap_config sun7i_codec_regmap_config = {
-   .reg_bits   = 32,
-   .reg_stride = 4,
-   .val_bits   = 32,
-   .max_register   = SUN7I_CODEC_AC_MIC_PHONE_CAL,
-};
-
-struct sun4i_codec_quirks {
-   const struct regmap_config *regmap_config;
-};
-
-static const struct sun4i_codec_quirks sun4i_codec_quirks = {
-   .regmap_config = _codec_regmap_config,
-};
-
-static const struct sun4i_codec_quirks sun7i_codec_quirks = {
-   .regmap_config = _codec_regmap_config,
-};
-
-static const struct of_device_id sun4i_codec_of_match[] = {
-   {
-   .compatible = "allwinner,sun4i-a10-codec",
-   .data = _codec_quirks,
-   },
-   {
-   .compatible = "allwinner,sun7i-a20-codec",
-   .data = _codec_quirks,
-   },
-   {}
-};
-MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
-
 static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev,
int *num_links)
 {
@@ -781,6 +742,45 @@ static struct snd_soc_card *sun4i_codec_create_card(struct 
device *dev)
return card;
 };
 
+static const struct regmap_config sun4i_codec_regmap_config = {
+   .reg_bits   = 32,
+   .reg_stride = 4,
+   .val_bits   = 32,
+   .max_register   = SUN4I_CODEC_ADC_RXCNT,
+};
+
+static const struct regmap_config sun7i_codec_regmap_config = {
+   .reg_bits   = 32,
+   .reg_stride = 4,
+   .val_bits   = 32,
+   .max_register   = SUN7I_CODEC_AC_MIC_PHONE_CAL,
+};
+
+struct sun4i_codec_quirks {
+   const struct regmap_config *regmap_config;
+};
+
+static const struct sun4i_codec_quirks sun4i_codec_quirks = {
+   .regmap_config  = _codec_regmap_config,
+};
+
+static const struct sun4i_codec_quirks sun7i_codec_quirks = {
+   .regmap_config  = _codec_regmap_config,
+};
+
+static const struct of_device_id sun4i_codec_of_match[] = {
+   {
+   .compatible = "allwinner,sun4i-a10-codec",
+   .data = _codec_quirks,
+   },
+   {
+   .compatible = "allwinner,sun7i-a20-codec",
+   .data = _codec_quirks,
+   },
+   {}
+};
+MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
+
 static int sun4i_codec_probe(struct platform_device *pdev)
 {
struct snd_soc_card *card;
-- 
2.10.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To 

[linux-sunxi] Re: [PATCH v2 13/14] ARM: dts: sun6i: hummingbird: Enable internal audio codec

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:55PM +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 
> ---
>  arch/arm/boot/dts/sun6i-a31-hummingbird.dts | 20 
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts 
> b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
> index 9a74637f677f..48c041b75aab 100644
> --- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
> +++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
> @@ -69,6 +69,19 @@
>   };
>  };
>  
> + {
> + allwinner,audio-routing =
> + "Headphone", "HP",
> + "Speaker", "LINEOUT",
> + "LINEIN", "Line In",
> + "MIC1", "Mic",
> + "MIC2", "Headset Mic",
> + "Mic",  "MBIAS",
> + "Headset Mic", "HBIAS";
> + allwinner,pa-gpios = < 7 22 GPIO_ACTIVE_HIGH>; /* PH22 */
> + status = "okay";
> +};
> +
>   {
>   cpu-supply = <_dcdc3>;
>  };
> @@ -152,6 +165,13 @@
>  };
>  
>   {
> + codec_pa_pin: codec_pa_pin@0 {
> + allwinner,pins = "PH22";
> + allwinner,function = "gpio_out";
> + allwinner,drive = ;
> + allwinner,pull = ;
> + };
> +

This pin group isn't used anywhere. Because of the strict thing in
pinctrl, I'd say it's better to not set it, but then, the pin group is
useless.

Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: [linux-sunxi] [PATCH v2 04/14] ASoC: sun4i-codec: Increase DMA max burst to 8

2016-11-03 Thread Priit Laes
On Thu, 2016-11-03 at 15:55 +0800, Chen-Yu Tsai wrote:
> According to the DMA engine API documentation, maxburst denotes the
> largest possible size of a single transfer, so as not to overflow
> destination FIFOs as explained in this excerpt from dmaengine.h
> 
>  * @src_maxburst: the maximum number of words (note: words, as in
>  * units of the src_addr_width member, not bytes) that can be sent
>  * in one burst to the device. Typically something like half the
>  * FIFO depth on I/O peripherals so you don't overflow it. This
>  * may or may not be applicable on memory sources.
>  * @dst_maxburst: same as src_maxburst but for destination target

>  * mutatis mutandis.

^^ :)

> 
> The TX FIFO is 64 samples deep for stereo, and the RX FIFO is 16
> samples deep. So maxburst could be 32 and 8 for TX and RX
> respectively.
> 
> Unfortunately the sunxi DMA controller driver takes maxburst as
> the requested burst size, rather than a limit, and returns an error
> for unsupported values. The original value was 4, but some later
> SoCs do not officially support this burst size.
> 
> This patch increases maxburst on the TX side to 8, which is supported
> by all variants of the sunxi DMA controller.
> 
> Cc: Vinod Koul 
> Signed-off-by: Chen-Yu Tsai 
> ---
>  sound/soc/sunxi/sun4i-codec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-
> codec.c
> index 61ae502a5061..d867b96d367b 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -886,12 +886,12 @@ static int sun4i_codec_probe(struct
> platform_device *pdev)
>  
>   /* DMA configuration for TX FIFO */
>   scodec->playback_dma_data.addr = res->start + quirks-
> >reg_dac_txdata;
> - scodec->playback_dma_data.maxburst = 4;
> + scodec->playback_dma_data.maxburst = 8;
>   scodec->playback_dma_data.addr_width =
> DMA_SLAVE_BUSWIDTH_2_BYTES;
>  
>   /* DMA configuration for RX FIFO */
>   scodec->capture_dma_data.addr = res->start + quirks-
> >reg_adc_rxdata;
> - scodec->capture_dma_data.maxburst = 4;
> + scodec->capture_dma_data.maxburst = 8;
>   scodec->capture_dma_data.addr_width =
> DMA_SLAVE_BUSWIDTH_2_BYTES;
>  
>   ret = snd_soc_register_codec(>dev, quirks->codec,
> -- 
> 2.10.2
> 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v2 11/14] ASoC: sun4i-codec: Add support for A31 board level audio routing

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:53PM +0800, Chen-Yu Tsai wrote:
> The A31 SoC's codec has various inputs, outputs and microphone bias
> supplies. These can be routed on the board in different ways, such as:
> 
>   - HPCOM may be connected to have the headphone DC coupled.
> 
>   - Microphones all use the MBIAS main microphone supply or one mic may
> use the HBIAS supply, which supports headset detection and buttons.
> 
>   - Line Out may be routed to an audio jack, or an onboard speaker amp
> with power controls.
> 
> Add support for specifying the audio routes in the device tree.
> 
> Signed-off-by: Chen-Yu Tsai 

Acked-by: Maxime Ripard 

Thanks,
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 10/14] ASoC: sun4i-codec: Add support for A31 ADC capture path

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:52PM +0800, Chen-Yu Tsai wrote:
> 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 

Acked-by: Maxime Ripard 
Thanks,
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 07/14] ASoC: sun4i-codec: Add support for A31 Line In playback

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:49PM +0800, Chen-Yu Tsai wrote:
> The A31 integrated codec has a stereo "Line In" input. Add support for
> it to the playback paths.
> 
> Signed-off-by: Chen-Yu Tsai 

Acked-by: Maxime Ripard 

Thanks,
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 05/14] ASoC: sun4i-codec: Add support for optional reset control to quirks

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:47PM +0800, Chen-Yu Tsai wrote:
> 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 

Acked-by: Maxime Ripard 

Thanks,
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 04/14] ASoC: sun4i-codec: Increase DMA max burst to 8

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:46PM +0800, Chen-Yu Tsai wrote:
> According to the DMA engine API documentation, maxburst denotes the
> largest possible size of a single transfer, so as not to overflow
> destination FIFOs as explained in this excerpt from dmaengine.h
> 
>  * @src_maxburst: the maximum number of words (note: words, as in
>  * units of the src_addr_width member, not bytes) that can be sent
>  * in one burst to the device. Typically something like half the
>  * FIFO depth on I/O peripherals so you don't overflow it. This
>  * may or may not be applicable on memory sources.
>  * @dst_maxburst: same as src_maxburst but for destination target
>  * mutatis mutandis.
> 
> The TX FIFO is 64 samples deep for stereo, and the RX FIFO is 16
> samples deep. So maxburst could be 32 and 8 for TX and RX respectively.
> 
> Unfortunately the sunxi DMA controller driver takes maxburst as
> the requested burst size, rather than a limit, and returns an error
> for unsupported values. The original value was 4, but some later
> SoCs do not officially support this burst size.
> 
> This patch increases maxburst on the TX side to 8, which is supported
> by all variants of the sunxi DMA controller.
> 
> Cc: Vinod Koul 
> Signed-off-by: Chen-Yu Tsai 

Acked-by: Maxime Ripard 

Thanks,
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 03/14] ASoC: sun4i-codec: Revise comments for register definition macros

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:45PM +0800, Chen-Yu Tsai wrote:
> This revises existing comments in the register definition macros
> section, and adds a few more, so that readers can clearly identify
> the types of control registers.
> 
> Signed-off-by: Chen-Yu Tsai 

Acked-by: Maxime Ripard 

Thanks!
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v2 01/14] ASoC: sun4i-codec: Move data structures to add create_card call to quirks

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 03:55:43PM +0800, Chen-Yu Tsai wrote:
> The audio codec on later Allwinner SoCs have a different layout and
> audio path compared to the A10/A20. However the PCM parts are still
> the same.
> 
> The different layout and audio paths mean we need a different
> create_card function for different families, so they can create
> DAPM endpoint widgets and routes.
> 
> This patch moves the regmap configs, quirks and of_device_id
> structures to just before the probe function, so we can, among other
> things, include a pointer for the create_card function. None of the
> lines of code were changed.
> 
> Signed-off-by: Chen-Yu Tsai 

Acked-by: Maxime Ripard 

Thanks!
Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v6 1/4] clk: sunxi-ng: Add A64 clocks

2016-11-03 Thread Maxime Ripard
On Thu, Nov 03, 2016 at 09:52:26AM +0800, Chen-Yu Tsai wrote:
> On Thu, Nov 3, 2016 at 5:50 AM, Maxime Ripard
>  wrote:
> > Add the A64 CCU clocks set.
> >
> > Acked-by: Rob Herring 
> > Signed-off-by: Maxime Ripard 
> 
> I thought I acked this one...
> 
> Skimming through it again, I think you would want to add CLK_SET_PARENT_RATE
> to the hdmi and mipi dsi module clocks.
> 
> Otherwise,
> 
> Acked-by: Chen-Yu Tsai 

I added the flags, and applied, thanks!

Maxime

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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH v6 4/4] arm64: dts: add Pine64 support

2016-11-03 Thread Maxime Ripard
On Wed, Nov 02, 2016 at 10:05:09PM +, André Przywara wrote:
> On 02/11/16 21:50, Maxime Ripard wrote:
> > From: Andre Przywara 
> > 
> > The Pine64 is a cost-efficient development board based on the
> > Allwinner A64 SoC.
> > There are three models: the basic version with Fast Ethernet and
> > 512 MB of DRAM (Pine64) and two Pine64+ versions, which both
> > feature Gigabit Ethernet and additional connectors for touchscreens
> > and a camera. Or as my son put it: "Those are smaller and these are
> > missing." ;-)
> > The two Pine64+ models just differ in the amount of DRAM
> > (1GB vs. 2GB). Since U-Boot will figure out the right size for us and
> > patches the DT accordingly we just need to provide one DT for the
> > Pine64+.
> > 
> > Signed-off-by: Andre Przywara 
> > [Maxime: Removed the common DTSI and include directly the pine64 DTS]
> > Signed-off-by: Maxime Ripard 
> > ---
> >  arch/arm64/boot/dts/Makefile |  1 +-
> >  arch/arm64/boot/dts/allwinner/Makefile   |  5 +-
> >  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 50 ++-
> >  arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts  | 74 +-
> >  4 files changed, 130 insertions(+), 0 deletions(-)
> >  create mode 100644 arch/arm64/boot/dts/allwinner/Makefile
> >  create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
> >  create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
> > 
> > diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
> > index 6684f97c2722..080232b0270e 100644
> > --- a/arch/arm64/boot/dts/Makefile
> > +++ b/arch/arm64/boot/dts/Makefile
> > @@ -1,4 +1,5 @@
> >  dts-dirs += al
> > +dts-dirs += allwinner
> >  dts-dirs += altera
> >  dts-dirs += amd
> >  dts-dirs += amlogic
> > diff --git a/arch/arm64/boot/dts/allwinner/Makefile 
> > b/arch/arm64/boot/dts/allwinner/Makefile
> > new file mode 100644
> > index ..1e29a5ae8282
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/allwinner/Makefile
> > @@ -0,0 +1,5 @@
> > +dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-plus.dtb 
> > sun50i-a64-pine64.dtb
> > +
> > +always := $(dtb-y)
> > +subdir-y   := $(dts-dirs)
> > +clean-files:= *.dtb
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts 
> > b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
> > new file mode 100644
> > index ..790d14daaa6a
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
> > @@ -0,0 +1,50 @@
> > +/*
> > + * Copyright (c) 2016 ARM Ltd.
> > + *
> > + * 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 library 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 library 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 "sun50i-a64-pine64.dts"
> > +
> > +/ {
> > +   model = "Pine64+";
> > +   compatible = "pine64,pine64-plus", "allwinner,sun50i-a64";
> > +
> > +   /* TODO: 

[linux-sunxi] [PATCH v2 01/14] ASoC: sun4i-codec: Move data structures to add create_card call to quirks

2016-11-03 Thread Chen-Yu Tsai
The audio codec on later Allwinner SoCs have a different layout and
audio path compared to the A10/A20. However the PCM parts are still
the same.

The different layout and audio paths mean we need a different
create_card function for different families, so they can create
DAPM endpoint widgets and routes.

This patch moves the regmap configs, quirks and of_device_id
structures to just before the probe function, so we can, among other
things, include a pointer for the create_card function. None of the
lines of code were changed.

Signed-off-by: Chen-Yu Tsai 
---
 sound/soc/sunxi/sun4i-codec.c | 78 +--
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 56ed9472e89f..249fa5033361 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -678,45 +678,6 @@ static struct snd_soc_dai_driver dummy_cpu_dai = {
 },
 };
 
-static const struct regmap_config sun4i_codec_regmap_config = {
-   .reg_bits   = 32,
-   .reg_stride = 4,
-   .val_bits   = 32,
-   .max_register   = SUN4I_CODEC_ADC_RXCNT,
-};
-
-static const struct regmap_config sun7i_codec_regmap_config = {
-   .reg_bits   = 32,
-   .reg_stride = 4,
-   .val_bits   = 32,
-   .max_register   = SUN7I_CODEC_AC_MIC_PHONE_CAL,
-};
-
-struct sun4i_codec_quirks {
-   const struct regmap_config *regmap_config;
-};
-
-static const struct sun4i_codec_quirks sun4i_codec_quirks = {
-   .regmap_config = _codec_regmap_config,
-};
-
-static const struct sun4i_codec_quirks sun7i_codec_quirks = {
-   .regmap_config = _codec_regmap_config,
-};
-
-static const struct of_device_id sun4i_codec_of_match[] = {
-   {
-   .compatible = "allwinner,sun4i-a10-codec",
-   .data = _codec_quirks,
-   },
-   {
-   .compatible = "allwinner,sun7i-a20-codec",
-   .data = _codec_quirks,
-   },
-   {}
-};
-MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
-
 static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev,
int *num_links)
 {
@@ -781,6 +742,45 @@ static struct snd_soc_card *sun4i_codec_create_card(struct 
device *dev)
return card;
 };
 
+static const struct regmap_config sun4i_codec_regmap_config = {
+   .reg_bits   = 32,
+   .reg_stride = 4,
+   .val_bits   = 32,
+   .max_register   = SUN4I_CODEC_ADC_RXCNT,
+};
+
+static const struct regmap_config sun7i_codec_regmap_config = {
+   .reg_bits   = 32,
+   .reg_stride = 4,
+   .val_bits   = 32,
+   .max_register   = SUN7I_CODEC_AC_MIC_PHONE_CAL,
+};
+
+struct sun4i_codec_quirks {
+   const struct regmap_config *regmap_config;
+};
+
+static const struct sun4i_codec_quirks sun4i_codec_quirks = {
+   .regmap_config  = _codec_regmap_config,
+};
+
+static const struct sun4i_codec_quirks sun7i_codec_quirks = {
+   .regmap_config  = _codec_regmap_config,
+};
+
+static const struct of_device_id sun4i_codec_of_match[] = {
+   {
+   .compatible = "allwinner,sun4i-a10-codec",
+   .data = _codec_quirks,
+   },
+   {
+   .compatible = "allwinner,sun7i-a20-codec",
+   .data = _codec_quirks,
+   },
+   {}
+};
+MODULE_DEVICE_TABLE(of, sun4i_codec_of_match);
+
 static int sun4i_codec_probe(struct platform_device *pdev)
 {
struct snd_soc_card *card;
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 12/14] ARM: dts: sun6i: Add audio codec device node

2016-11-03 Thread Chen-Yu Tsai
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 
---
 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 = ;
+   clocks = < CLK_APB1_CODEC>, < CLK_CODEC>;
+   clock-names = "apb", "codec";
+   resets = < RST_APB1_CODEC>;
+   dmas = < 15>, < 15>;
+   dma-names = "rx", "tx";
+   status = "disabled";
+   };
+
timer@01c6 {
compatible = "allwinner,sun6i-a31-hstimer",
 "allwinner,sun7i-a20-hstimer";
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 14/14] ARM: dts: sun6i: sina31s: Enable internal audio codec

2016-11-03 Thread Chen-Yu Tsai
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 
---
 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 @@
};
 };
 
+ {
+   allwinner,audio-routing =
+   "Line Out", "LINEOUT",
+   "MIC1", "Mic",
+   "Mic",  "MBIAS";
+   status = "okay";
+};
+
  {
/* USB 2.0 4 port hub IC */
status = "okay";
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 07/14] ASoC: sun4i-codec: Add support for A31 Line In playback

2016-11-03 Thread Chen-Yu Tsai
The A31 integrated codec has a stereo "Line In" input. Add support for
it to the playback paths.

Signed-off-by: Chen-Yu Tsai 
---
 sound/soc/sunxi/sun4i-codec.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 12b9e08a3e64..4abac9962165 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -774,6 +774,10 @@ static const struct snd_kcontrol_new 
sun6i_codec_mixer_controls[] = {
SUN6I_CODEC_OM_DACA_CTRL,
SUN6I_CODEC_OM_DACA_CTRL_LMIX_DACR,
SUN6I_CODEC_OM_DACA_CTRL_RMIX_DACL, 1, 0),
+   SOC_DAPM_DOUBLE("Line In Playback Switch",
+   SUN6I_CODEC_OM_DACA_CTRL,
+   SUN6I_CODEC_OM_DACA_CTRL_LMIX_LINEINL,
+   SUN6I_CODEC_OM_DACA_CTRL_RMIX_LINEINR, 1, 0),
 };
 
 /* headphone controls */
@@ -795,6 +799,8 @@ static const struct snd_kcontrol_new sun6i_codec_hp_src[] = 
{
 /* volume / mute controls */
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_dvol_scale, -7308, 116, 0);
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_hp_vol_scale, -6300, 100, 1);
+static const DECLARE_TLV_DB_SCALE(sun6i_codec_out_mixer_pregain_scale,
+ -450, 150, 0);
 
 static const struct snd_kcontrol_new sun6i_codec_codec_widgets[] = {
SOC_SINGLE_TLV("DAC Playback Volume", SUN4I_CODEC_DAC_DPC,
@@ -808,9 +814,16 @@ static const struct snd_kcontrol_new 
sun6i_codec_codec_widgets[] = {
   SUN6I_CODEC_OM_DACA_CTRL,
   SUN6I_CODEC_OM_DACA_CTRL_LHPPAMUTE,
   SUN6I_CODEC_OM_DACA_CTRL_RHPPAMUTE, 1, 0),
+   /* Mixer pre-gains */
+   SOC_SINGLE_TLV("Line In Playback Volume",
+  SUN6I_CODEC_OM_PA_CTRL, SUN6I_CODEC_OM_PA_CTRL_LINEING,
+  0x7, 0, sun6i_codec_out_mixer_pregain_scale),
 };
 
 static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
+   /* Line In */
+   SND_SOC_DAPM_INPUT("LINEIN"),
+
/* Digital parts of the DACs */
SND_SOC_DAPM_SUPPLY("DAC Enable", SUN4I_CODEC_DAC_DPC,
SUN4I_CODEC_DAC_DPC_EN_DA, 0,
@@ -852,10 +865,12 @@ static const struct snd_soc_dapm_route 
sun6i_codec_codec_dapm_routes[] = {
/* 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" },
 
/* 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" },
 
/* Headphone Routes */
{ "Headphone Source Playback Route", "DAC", "Left DAC" },
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 10/14] ASoC: sun4i-codec: Add support for A31 ADC capture path

2016-11-03 Thread Chen-Yu Tsai
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 
---
 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 a0fedb059f1b..0cb728964ff0 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" },
 

[linux-sunxi] [PATCH v2 08/14] ASoC: sun4i-codec: Add support for A31 Line Out playback

2016-11-03 Thread Chen-Yu Tsai
The A31 integrated codec has a second "Line Out" output which does not
include an integrated amplifier in its path. This path does have a
separate volume control.

This patch adds support for the playback path from the DAC to the Line
Out pins.

Signed-off-by: Chen-Yu Tsai 
---
 sound/soc/sunxi/sun4i-codec.c | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 4abac9962165..8ba7804a68ed 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -796,11 +796,31 @@ static const struct snd_kcontrol_new sun6i_codec_hp_src[] 
= {
  sun6i_codec_hp_src_enum),
 };
 
+/* line out controls */
+static const char * const sun6i_codec_lineout_src_enum_text[] = {
+   "Stereo", "Mono Differential",
+};
+
+static SOC_ENUM_DOUBLE_DECL(sun6i_codec_lineout_src_enum,
+   SUN6I_CODEC_MIC_CTRL,
+   SUN6I_CODEC_MIC_CTRL_LINEOUTLSRC,
+   SUN6I_CODEC_MIC_CTRL_LINEOUTRSRC,
+   sun6i_codec_lineout_src_enum_text);
+
+static const struct snd_kcontrol_new sun6i_codec_lineout_src[] = {
+   SOC_DAPM_ENUM("Line Out Source Playback Route",
+ sun6i_codec_lineout_src_enum),
+};
+
 /* volume / mute controls */
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_dvol_scale, -7308, 116, 0);
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_hp_vol_scale, -6300, 100, 1);
 static const DECLARE_TLV_DB_SCALE(sun6i_codec_out_mixer_pregain_scale,
  -450, 150, 0);
+static const DECLARE_TLV_DB_RANGE(sun6i_codec_lineout_vol_scale,
+   0, 1, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
+   2, 31, TLV_DB_SCALE_ITEM(-4350, 150, 0),
+);
 
 static const struct snd_kcontrol_new sun6i_codec_codec_widgets[] = {
SOC_SINGLE_TLV("DAC Playback Volume", SUN4I_CODEC_DAC_DPC,
@@ -810,10 +830,18 @@ static const struct snd_kcontrol_new 
sun6i_codec_codec_widgets[] = {
   SUN6I_CODEC_OM_DACA_CTRL,
   SUN6I_CODEC_OM_DACA_CTRL_HPVOL, 0x3f, 0,
   sun6i_codec_hp_vol_scale),
+   SOC_SINGLE_TLV("Line Out Playback Volume",
+  SUN6I_CODEC_MIC_CTRL,
+  SUN6I_CODEC_MIC_CTRL_LINEOUTVC, 0x1f, 0,
+  sun6i_codec_lineout_vol_scale),
SOC_DOUBLE("Headphone Playback Switch",
   SUN6I_CODEC_OM_DACA_CTRL,
   SUN6I_CODEC_OM_DACA_CTRL_LHPPAMUTE,
   SUN6I_CODEC_OM_DACA_CTRL_RHPPAMUTE, 1, 0),
+   SOC_DOUBLE("Line Out Playback Switch",
+  SUN6I_CODEC_MIC_CTRL,
+  SUN6I_CODEC_MIC_CTRL_LINEOUTLEN,
+  SUN6I_CODEC_MIC_CTRL_LINEOUTREN, 1, 0),
/* Mixer pre-gains */
SOC_SINGLE_TLV("Line In Playback Volume",
   SUN6I_CODEC_OM_PA_CTRL, SUN6I_CODEC_OM_PA_CTRL_LINEING,
@@ -855,6 +883,11 @@ static const struct snd_soc_dapm_widget 
sun6i_codec_codec_dapm_widgets[] = {
SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPCOM", SUN6I_CODEC_OM_PA_CTRL,
 SUN6I_CODEC_OM_PA_CTRL_HPCOM_CTL, 0x3, 0x3, 0),
SND_SOC_DAPM_OUTPUT("HP"),
+
+   /* Line Out path */
+   SND_SOC_DAPM_MUX("Line Out Source Playback Route",
+SND_SOC_NOPM, 0, 0, sun6i_codec_lineout_src),
+   SND_SOC_DAPM_OUTPUT("LINEOUT"),
 };
 
 static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
@@ -880,6 +913,12 @@ static const struct snd_soc_dapm_route 
sun6i_codec_codec_dapm_routes[] = {
{ "Headphone Amp", NULL, "Headphone Source Playback Route" },
{ "HP", NULL, "Headphone Amp" },
{ "HPCOM", NULL, "HPCOM Protection" },
+
+   /* Line Out 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" },
+   { "LINEOUT", NULL, "Line Out Source Playback Route" },
 };
 
 static struct snd_soc_codec_driver sun6i_codec_codec = {
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 03/14] ASoC: sun4i-codec: Revise comments for register definition macros

2016-11-03 Thread Chen-Yu Tsai
This revises existing comments in the register definition macros
section, and adds a few more, so that readers can clearly identify
the types of control registers.

Signed-off-by: Chen-Yu Tsai 
---
 sound/soc/sunxi/sun4i-codec.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index dbb47f255bd8..61ae502a5061 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -40,7 +40,7 @@
 #include 
 #include 
 
-/* Codec DAC register offsets and bit fields */
+/* Codec DAC digital controls and FIFO registers */
 #define SUN4I_CODEC_DAC_DPC(0x00)
 #define SUN4I_CODEC_DAC_DPC_EN_DA  (31)
 #define SUN4I_CODEC_DAC_DPC_DVOL   (12)
@@ -57,6 +57,8 @@
 #define SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH   (0)
 #define SUN4I_CODEC_DAC_FIFOS  (0x08)
 #define SUN4I_CODEC_DAC_TXDATA (0x0c)
+
+/* Codec DAC side analog signal controls */
 #define SUN4I_CODEC_DAC_ACTL   (0x10)
 #define SUN4I_CODEC_DAC_ACTL_DACAENR   (31)
 #define SUN4I_CODEC_DAC_ACTL_DACAENL   (30)
@@ -71,7 +73,7 @@
 #define SUN4I_CODEC_DAC_TUNE   (0x14)
 #define SUN4I_CODEC_DAC_DEBUG  (0x18)
 
-/* Codec ADC register offsets and bit fields */
+/* Codec ADC digital controls and FIFO registers */
 #define SUN4I_CODEC_ADC_FIFOC  (0x1c)
 #define SUN4I_CODEC_ADC_FIFOC_ADC_FS   (29)
 #define SUN4I_CODEC_ADC_FIFOC_EN_AD(28)
@@ -83,6 +85,8 @@
 #define SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH   (0)
 #define SUN4I_CODEC_ADC_FIFOS  (0x20)
 #define SUN4I_CODEC_ADC_RXDATA (0x24)
+
+/* Codec ADC side analog signal controls */
 #define SUN4I_CODEC_ADC_ACTL   (0x28)
 #define SUN4I_CODEC_ADC_ACTL_ADC_R_EN  (31)
 #define SUN4I_CODEC_ADC_ACTL_ADC_L_EN  (30)
@@ -95,10 +99,14 @@
 #define SUN4I_CODEC_ADC_ACTL_DDE   (3)
 #define SUN4I_CODEC_ADC_DEBUG  (0x2c)
 
-/* Other various ADC registers */
+/* FIFO counters */
 #define SUN4I_CODEC_DAC_TXCNT  (0x30)
 #define SUN4I_CODEC_ADC_RXCNT  (0x34)
+
+/* Calibration register (sun7i only) */
 #define SUN7I_CODEC_AC_DAC_CAL (0x38)
+
+/* Microphone controls (sun7i only) */
 #define SUN7I_CODEC_AC_MIC_PHONE_CAL   (0x3c)
 
 struct sun4i_codec {
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 06/14] ASoC: sun4i-codec: Add support for A31 playback through headphone output

2016-11-03 Thread Chen-Yu Tsai
The A31 has a similar codec to the A10/A20. The PCM parts are very
similar, with different register offsets. The analog paths are very
different. There are more inputs and outputs. The ADC mux has been
replaced with a proper mixer.

This patch adds support for the basic playback path of the A31 codec,
from the DAC to the headphones. Headphone detection, microphone,
signaling, other inputs/outputs and capture will be added later.

Signed-off-by: Chen-Yu Tsai 
---
 .../devicetree/bindings/sound/sun4i-codec.txt  |  22 +-
 sound/soc/sunxi/sun4i-codec.c  | 271 -
 2 files changed, 287 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt 
b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
index 0dce690f78f5..bf480e9683a3 100644
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
@@ -1,8 +1,10 @@
 * Allwinner A10 Codec
 
 Required properties:
-- compatible: must be either "allwinner,sun4i-a10-codec" or
-  "allwinner,sun7i-a20-codec"
+- compatible: must be one of the following compatibles:
+   - "allwinner,sun4i-a10-codec"
+   - "allwinner,sun6i-a31-codec"
+   - "allwinner,sun7i-a20-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,
@@ -17,6 +19,10 @@ Required properties:
 Optional properties:
 - allwinner,pa-gpios: gpio to enable external amplifier
 
+Required properties for the following compatibles:
+   - "allwinner,sun6i-a31-codec"
+- resets: phandle to the reset control for this device
+
 Example:
 codec: codec@01c22c00 {
#sound-dai-cells = <0>;
@@ -28,3 +34,15 @@ codec: codec@01c22c00 {
dmas = < 0 19>, < 0 19>;
dma-names = "rx", "tx";
 };
+
+codec: codec@01c22c00 {
+   #sound-dai-cells = <0>;
+   compatible = "allwinner,sun6i-a31-codec";
+   reg = <0x01c22c00 0x98>;
+   interrupts = ;
+   clocks = < CLK_APB1_CODEC>, < CLK_CODEC>;
+   clock-names = "apb", "codec";
+   resets = < RST_APB1_CODEC>;
+   dmas = < 15>, < 15>;
+   dma-names = "rx", "tx";
+};
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index e502966abf8e..12b9e08a3e64 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -110,6 +110,109 @@
 /* Microphone controls (sun7i only) */
 #define SUN7I_CODEC_AC_MIC_PHONE_CAL   (0x3c)
 
+/*
+ * sun6i specific registers
+ *
+ * sun6i shares the same digital control and FIFO registers as sun4i,
+ * but only the DAC digital controls are at the same offset. The others
+ * have been moved around to accommodate extra analog controls.
+ */
+
+/* Codec DAC digital controls and FIFO registers */
+#define SUN6I_CODEC_ADC_FIFOC  (0x10)
+#define SUN6I_CODEC_ADC_FIFOC_EN_AD(28)
+#define SUN6I_CODEC_ADC_FIFOS  (0x14)
+#define SUN6I_CODEC_ADC_RXDATA (0x18)
+
+/* Output mixer and gain controls */
+#define SUN6I_CODEC_OM_DACA_CTRL   (0x20)
+#define SUN6I_CODEC_OM_DACA_CTRL_DACAREN   (31)
+#define SUN6I_CODEC_OM_DACA_CTRL_DACALEN   (30)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIXEN(29)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIXEN(28)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC1 (23)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC2 (22)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_PHONE(21)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_PHONEP   (20)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_LINEINR  (19)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_DACR (18)
+#define SUN6I_CODEC_OM_DACA_CTRL_RMIX_DACL (17)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_MIC1 (16)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_MIC2 (15)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_PHONE(14)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_PHONEN   (13)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_LINEINL  (12)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_DACL (11)
+#define SUN6I_CODEC_OM_DACA_CTRL_LMIX_DACR (10)
+#define SUN6I_CODEC_OM_DACA_CTRL_RHPIS (9)
+#define SUN6I_CODEC_OM_DACA_CTRL_LHPIS (8)
+#define SUN6I_CODEC_OM_DACA_CTRL_RHPPAMUTE (7)
+#define SUN6I_CODEC_OM_DACA_CTRL_LHPPAMUTE (6)
+#define SUN6I_CODEC_OM_DACA_CTRL_HPVOL (0)
+#define SUN6I_CODEC_OM_PA_CTRL (0x24)
+#define SUN6I_CODEC_OM_PA_CTRL_HPPAEN  (31)
+#define SUN6I_CODEC_OM_PA_CTRL_HPCOM_CTL   (29)
+#define SUN6I_CODEC_OM_PA_CTRL_COMPTEN (28)
+#define SUN6I_CODEC_OM_PA_CTRL_MIC1G   (15)
+#define SUN6I_CODEC_OM_PA_CTRL_MIC2G   

[linux-sunxi] [PATCH v2 04/14] ASoC: sun4i-codec: Increase DMA max burst to 8

2016-11-03 Thread Chen-Yu Tsai
According to the DMA engine API documentation, maxburst denotes the
largest possible size of a single transfer, so as not to overflow
destination FIFOs as explained in this excerpt from dmaengine.h

 * @src_maxburst: the maximum number of words (note: words, as in
 * units of the src_addr_width member, not bytes) that can be sent
 * in one burst to the device. Typically something like half the
 * FIFO depth on I/O peripherals so you don't overflow it. This
 * may or may not be applicable on memory sources.
 * @dst_maxburst: same as src_maxburst but for destination target
 * mutatis mutandis.

The TX FIFO is 64 samples deep for stereo, and the RX FIFO is 16
samples deep. So maxburst could be 32 and 8 for TX and RX respectively.

Unfortunately the sunxi DMA controller driver takes maxburst as
the requested burst size, rather than a limit, and returns an error
for unsupported values. The original value was 4, but some later
SoCs do not officially support this burst size.

This patch increases maxburst on the TX side to 8, which is supported
by all variants of the sunxi DMA controller.

Cc: Vinod Koul 
Signed-off-by: Chen-Yu Tsai 
---
 sound/soc/sunxi/sun4i-codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 61ae502a5061..d867b96d367b 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -886,12 +886,12 @@ static int sun4i_codec_probe(struct platform_device *pdev)
 
/* DMA configuration for TX FIFO */
scodec->playback_dma_data.addr = res->start + quirks->reg_dac_txdata;
-   scodec->playback_dma_data.maxburst = 4;
+   scodec->playback_dma_data.maxburst = 8;
scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 
/* DMA configuration for RX FIFO */
scodec->capture_dma_data.addr = res->start + quirks->reg_adc_rxdata;
-   scodec->capture_dma_data.maxburst = 4;
+   scodec->capture_dma_data.maxburst = 8;
scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 
ret = snd_soc_register_codec(>dev, quirks->codec,
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 09/14] ASoC: sun4i-codec: Add support for A31 analog microphone inputs

2016-11-03 Thread Chen-Yu Tsai
The A31 internal codec has 3 microphone outputs, of which MIC2 and MIC3
are muxed internally. The resulting two microphone inputs have separate
gain controls and mixer inputs.

The codec also has 2 microphone bias pins. HBIAS is specifically for the
headphone jack, which also supports headphone detection and control
buttons. These extra functions are not supported yet. The other, MBIAS,
is for all other analog microphones.

There is also mention of digital microphone support, but documentation
is scarce, and no hardware with it is available.

Signed-off-by: Chen-Yu Tsai 
---
 sound/soc/sunxi/sun4i-codec.c | 70 +++
 1 file changed, 70 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 8ba7804a68ed..a0fedb059f1b 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -778,6 +778,14 @@ static const struct snd_kcontrol_new 
sun6i_codec_mixer_controls[] = {
SUN6I_CODEC_OM_DACA_CTRL,
SUN6I_CODEC_OM_DACA_CTRL_LMIX_LINEINL,
SUN6I_CODEC_OM_DACA_CTRL_RMIX_LINEINR, 1, 0),
+   SOC_DAPM_DOUBLE("Mic1 Playback Switch",
+   SUN6I_CODEC_OM_DACA_CTRL,
+   SUN6I_CODEC_OM_DACA_CTRL_LMIX_MIC1,
+   SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC1, 1, 0),
+   SOC_DAPM_DOUBLE("Mic2 Playback Switch",
+   SUN6I_CODEC_OM_DACA_CTRL,
+   SUN6I_CODEC_OM_DACA_CTRL_LMIX_MIC2,
+   SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC2, 1, 0),
 };
 
 /* headphone controls */
@@ -796,6 +804,21 @@ static const struct snd_kcontrol_new sun6i_codec_hp_src[] 
= {
  sun6i_codec_hp_src_enum),
 };
 
+/* microphone controls */
+static const char * const sun6i_codec_mic2_src_enum_text[] = {
+   "Mic2", "Mic3",
+};
+
+static SOC_ENUM_SINGLE_DECL(sun6i_codec_mic2_src_enum,
+   SUN6I_CODEC_MIC_CTRL,
+   SUN6I_CODEC_MIC_CTRL_MIC2SLT,
+   sun6i_codec_mic2_src_enum_text);
+
+static const struct snd_kcontrol_new sun6i_codec_mic2_src[] = {
+   SOC_DAPM_ENUM("Mic2 Amplifier Source Route",
+ sun6i_codec_mic2_src_enum),
+};
+
 /* line out controls */
 static const char * const sun6i_codec_lineout_src_enum_text[] = {
"Stereo", "Mono Differential",
@@ -821,6 +844,10 @@ static const 
DECLARE_TLV_DB_RANGE(sun6i_codec_lineout_vol_scale,
0, 1, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
2, 31, TLV_DB_SCALE_ITEM(-4350, 150, 0),
 );
+static const DECLARE_TLV_DB_RANGE(sun6i_codec_mic_gain_scale,
+   0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
+   1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0),
+);
 
 static const struct snd_kcontrol_new sun6i_codec_codec_widgets[] = {
SOC_SINGLE_TLV("DAC Playback Volume", SUN4I_CODEC_DAC_DPC,
@@ -846,9 +873,42 @@ static const struct snd_kcontrol_new 
sun6i_codec_codec_widgets[] = {
SOC_SINGLE_TLV("Line In Playback Volume",
   SUN6I_CODEC_OM_PA_CTRL, SUN6I_CODEC_OM_PA_CTRL_LINEING,
   0x7, 0, sun6i_codec_out_mixer_pregain_scale),
+   SOC_SINGLE_TLV("Mic1 Playback Volume",
+  SUN6I_CODEC_OM_PA_CTRL, SUN6I_CODEC_OM_PA_CTRL_MIC1G,
+  0x7, 0, sun6i_codec_out_mixer_pregain_scale),
+   SOC_SINGLE_TLV("Mic2 Playback Volume",
+  SUN6I_CODEC_OM_PA_CTRL, SUN6I_CODEC_OM_PA_CTRL_MIC2G,
+  0x7, 0, sun6i_codec_out_mixer_pregain_scale),
+
+   /* Microphone Amp boost gains */
+   SOC_SINGLE_TLV("Mic1 Boost Volume", SUN6I_CODEC_MIC_CTRL,
+  SUN6I_CODEC_MIC_CTRL_MIC1BOOST, 0x7, 0,
+  sun6i_codec_mic_gain_scale),
+   SOC_SINGLE_TLV("Mic2 Boost Volume", SUN6I_CODEC_MIC_CTRL,
+  SUN6I_CODEC_MIC_CTRL_MIC2BOOST, 0x7, 0,
+  sun6i_codec_mic_gain_scale),
 };
 
 static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
+   /* Microphone inputs */
+   SND_SOC_DAPM_INPUT("MIC1"),
+   SND_SOC_DAPM_INPUT("MIC2"),
+   SND_SOC_DAPM_INPUT("MIC3"),
+
+   /* Microphone Bias */
+   SND_SOC_DAPM_SUPPLY("HBIAS", SUN6I_CODEC_MIC_CTRL,
+   SUN6I_CODEC_MIC_CTRL_HBIASEN, 0, NULL, 0),
+   SND_SOC_DAPM_SUPPLY("MBIAS", SUN6I_CODEC_MIC_CTRL,
+   SUN6I_CODEC_MIC_CTRL_MBIASEN, 0, NULL, 0),
+
+   /* Mic input path */
+   SND_SOC_DAPM_MUX("Mic2 Amplifier Source Route",
+SND_SOC_NOPM, 0, 0, sun6i_codec_mic2_src),
+   SND_SOC_DAPM_PGA("Mic1 Amplifier", SUN6I_CODEC_MIC_CTRL,
+SUN6I_CODEC_MIC_CTRL_MIC1AMPEN, 0, NULL, 0),
+   SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN6I_CODEC_MIC_CTRL,
+SUN6I_CODEC_MIC_CTRL_MIC2AMPEN, 0, NULL, 0),
+
/* Line In */

[linux-sunxi] [PATCH v2 00/14] ASoC: sun4i-codec: Add support for A31 Codec

2016-11-03 Thread Chen-Yu Tsai
Hi everyone,

This is v2 of my Allwinner A31 audio codec support series. The ASoC DAPM
stereo control patches in v1 were split out and merged already. These
remaining patches depend on them.

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 v1:

  - Patches 1, 2, 3 and 4 were split out from patch 6.

  - Reworked handling of register offset differences with regmap_field,
as suggested by Maxime.

  - Added support for an optional (in the driver) reset control (patch 5)

  - Added required reset control for sun6i-a31-codec

  - Added more comments for sun6i registers

  - Added HPCOM (direct drive mode) support

  - Renamed sun6i audio card name to "A31 Audio Codec"

  - Added example for allwinner,sun6i-a31-codec device tree

  - Fixed line out volume control scale

  - Added external amplifier enable GPIO for Hummingbird A31

  - Added patch to enable audio codec on Sinlinx SinA31s

Patch 1 moves some code around to facilitate patch 2. No code was
changed

Patch 2 expands the quirks to handle different register offsets for

- ADC FIFO controls, using regmap_field's

- RX/TX FIFO addresses, with offsets stored directly, as these
  are only used to setup DMA and not actually accessed by the
  driver

- card setup functions, as the newer codecs have a very different
  layout

Patch 3 fixes some of the comments in the register definition section,
so the separation of different functions is clearer.

Patch 4 increases the maximum DMA burst size from 4 to 8. 4 is not
a valid size on later SoCs.

Patch 5 adds driver support for an optional reset control.

Patches 6 through 11 add support for the A31's internal codec, one
feature per patch. Hopefully this makes it easier to review. Some
features, such as PHONE inputs/outputs, audio processing, headset
jack detection and buttons, aren't supported yet.

Patch 12 adds a device node for the codec to the A31 dtsi.

Patch 13 enables the codec for the Hummingbird A31 board.

Patch 14 enables the codec for the Sinlinx SinA31s board.


Please let me know what you think.

Regards
ChenYu


Chen-Yu Tsai (14):
  ASoC: sun4i-codec: Move data structures to add create_card call to
quirks
  ASoC: sun4i-codec: Expand quirks to handle register offsets and card
creation
  ASoC: sun4i-codec: Revise comments for register definition macros
  ASoC: sun4i-codec: Increase DMA max burst to 8
  ASoC: sun4i-codec: Add support for optional reset control to quirks
  ASoC: sun4i-codec: Add support for A31 playback through headphone
output
  ASoC: sun4i-codec: Add support for A31 Line In playback
  ASoC: sun4i-codec: Add support for A31 Line Out playback
  ASoC: sun4i-codec: Add support for A31 analog microphone inputs
  ASoC: sun4i-codec: Add support for A31 ADC capture path
  ASoC: sun4i-codec: Add support for A31 board level audio routing
  ARM: dts: sun6i: Add audio codec device node
  ARM: dts: sun6i: hummingbird: Enable internal audio codec
  ARM: dts: sun6i: sina31s: Enable internal audio codec

 .../devicetree/bindings/sound/sun4i-codec.txt  |  55 +-
 arch/arm/boot/dts/sun6i-a31-hummingbird.dts|  20 +
 arch/arm/boot/dts/sun6i-a31.dtsi   |  13 +
 arch/arm/boot/dts/sun6i-a31s-sina31s.dts   |   8 +
 sound/soc/sunxi/sun4i-codec.c  | 688 ++---
 5 files changed, 706 insertions(+), 78 deletions(-)

-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.