mirror of
https://github.com/Fishwaldo/build.git
synced 2025-07-24 05:48:41 +00:00
delete more useless patches
This commit is contained in:
parent
47e2e42553
commit
dcb2ac9dfb
4 changed files with 0 additions and 733 deletions
|
@ -1,117 +0,0 @@
|
|||
From e4ff7b4f7eddc3a9adc41f3f1d97444a72561910 Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Fri, 12 Oct 2018 08:27:43 -0700
|
||||
Subject: [PATCH 113/146] ASoC: sun4i-i2s: move code from startup/shutdown
|
||||
hooks into pm_runtime hooks
|
||||
|
||||
startup() and shutdown() hooks are called for both substreams,
|
||||
so stopping either substream when another is running breaks the
|
||||
latter.
|
||||
|
||||
E.g. playback breaks if capture is stopped when playback is running.
|
||||
|
||||
Move code from startup() and shutdown() to resume() and suspend()
|
||||
hooks respectively to fix this issue
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
sound/soc/sunxi/sun4i-i2s.c | 61 +++++++++++++++----------------------
|
||||
1 file changed, 25 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
|
||||
index a4aa931ebfae..daa6c08cffbc 100644
|
||||
--- a/sound/soc/sunxi/sun4i-i2s.c
|
||||
+++ b/sound/soc/sunxi/sun4i-i2s.c
|
||||
@@ -644,40 +644,6 @@ static int sun4i_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int sun4i_i2s_startup(struct snd_pcm_substream *substream,
|
||||
- struct snd_soc_dai *dai)
|
||||
-{
|
||||
- struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
-
|
||||
- /* Enable the whole hardware block */
|
||||
- regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
- SUN4I_I2S_CTRL_GL_EN, SUN4I_I2S_CTRL_GL_EN);
|
||||
-
|
||||
- /* Enable the first output line */
|
||||
- regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
- SUN4I_I2S_CTRL_SDO_EN_MASK,
|
||||
- SUN4I_I2S_CTRL_SDO_EN(0));
|
||||
-
|
||||
-
|
||||
- return clk_prepare_enable(i2s->mod_clk);
|
||||
-}
|
||||
-
|
||||
-static void sun4i_i2s_shutdown(struct snd_pcm_substream *substream,
|
||||
- struct snd_soc_dai *dai)
|
||||
-{
|
||||
- struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
-
|
||||
- clk_disable_unprepare(i2s->mod_clk);
|
||||
-
|
||||
- /* Disable our output lines */
|
||||
- regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
- SUN4I_I2S_CTRL_SDO_EN_MASK, 0);
|
||||
-
|
||||
- /* Disable the whole hardware block */
|
||||
- regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
- SUN4I_I2S_CTRL_GL_EN, 0);
|
||||
-}
|
||||
-
|
||||
static int sun4i_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id,
|
||||
unsigned int freq, int dir)
|
||||
{
|
||||
@@ -695,8 +661,6 @@ static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = {
|
||||
.hw_params = sun4i_i2s_hw_params,
|
||||
.set_fmt = sun4i_i2s_set_fmt,
|
||||
.set_sysclk = sun4i_i2s_set_sysclk,
|
||||
- .shutdown = sun4i_i2s_shutdown,
|
||||
- .startup = sun4i_i2s_startup,
|
||||
.trigger = sun4i_i2s_trigger,
|
||||
};
|
||||
|
||||
@@ -869,6 +833,21 @@ static int sun4i_i2s_runtime_resume(struct device *dev)
|
||||
goto err_disable_clk;
|
||||
}
|
||||
|
||||
+ /* Enable the whole hardware block */
|
||||
+ regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
+ SUN4I_I2S_CTRL_GL_EN, SUN4I_I2S_CTRL_GL_EN);
|
||||
+
|
||||
+ /* Enable the first output line */
|
||||
+ regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
+ SUN4I_I2S_CTRL_SDO_EN_MASK,
|
||||
+ SUN4I_I2S_CTRL_SDO_EN(0));
|
||||
+
|
||||
+ ret = clk_prepare_enable(i2s->mod_clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Failed to enable module clock\n");
|
||||
+ goto err_disable_clk;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_disable_clk:
|
||||
@@ -880,6 +859,16 @@ static int sun4i_i2s_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct sun4i_i2s *i2s = dev_get_drvdata(dev);
|
||||
|
||||
+ clk_disable_unprepare(i2s->mod_clk);
|
||||
+
|
||||
+ /* Disable our output lines */
|
||||
+ regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
+ SUN4I_I2S_CTRL_SDO_EN_MASK, 0);
|
||||
+
|
||||
+ /* Disable the whole hardware block */
|
||||
+ regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
+ SUN4I_I2S_CTRL_GL_EN, 0);
|
||||
+
|
||||
regcache_cache_only(i2s->regmap, true);
|
||||
|
||||
clk_disable_unprepare(i2s->bus_clk);
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
From 4bfc6b2d77838f3c04e4a1b0814fcf17be2b048f Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Cooper <codekipper@gmail.com>
|
||||
Date: Sun, 3 Dec 2017 10:09:08 -0800
|
||||
Subject: [PATCH 114/146] ASoC: sun4i-i2s: Add compatibility with A64 codec I2S
|
||||
|
||||
The I2S block used for the audio codec in the A64 differs from other 3
|
||||
I2S modules in A64 and isn't compatible with H3. But it is very similar
|
||||
to what is found in A10(sun4i). However, its TX FIFO is
|
||||
located at a different address.
|
||||
|
||||
Signed-off-by: Marcus Cooper <codekipper@gmail.com>
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
.../devicetree/bindings/sound/sun4i-i2s.txt | 2 ++
|
||||
sound/soc/sunxi/sun4i-i2s.c | 21 +++++++++++++++++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/sound/sun4i-i2s.txt b/Documentation/devicetree/bindings/sound/sun4i-i2s.txt
|
||||
index b9d50d6cdef3..61e71c1729e0 100644
|
||||
--- a/Documentation/devicetree/bindings/sound/sun4i-i2s.txt
|
||||
+++ b/Documentation/devicetree/bindings/sound/sun4i-i2s.txt
|
||||
@@ -10,6 +10,7 @@ Required properties:
|
||||
- "allwinner,sun6i-a31-i2s"
|
||||
- "allwinner,sun8i-a83t-i2s"
|
||||
- "allwinner,sun8i-h3-i2s"
|
||||
+ - "allwinner,sun50i-a64-codec-i2s"
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- interrupts: should contain the I2S interrupt.
|
||||
@@ -26,6 +27,7 @@ Required properties for the following compatibles:
|
||||
- "allwinner,sun6i-a31-i2s"
|
||||
- "allwinner,sun8i-a83t-i2s"
|
||||
- "allwinner,sun8i-h3-i2s"
|
||||
+ - "allwinner,sun50i-a64-codec-i2s"
|
||||
- resets: phandle to the reset line for this codec
|
||||
|
||||
Example:
|
||||
diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
|
||||
index daa6c08cffbc..d5ec1a20499d 100644
|
||||
--- a/sound/soc/sunxi/sun4i-i2s.c
|
||||
+++ b/sound/soc/sunxi/sun4i-i2s.c
|
||||
@@ -950,6 +950,23 @@ static const struct sun4i_i2s_quirks sun8i_h3_i2s_quirks = {
|
||||
.field_rxchansel = REG_FIELD(SUN8I_I2S_RX_CHAN_SEL_REG, 0, 2),
|
||||
};
|
||||
|
||||
+static const struct sun4i_i2s_quirks sun50i_a64_codec_i2s_quirks = {
|
||||
+ .has_reset = true,
|
||||
+ .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG,
|
||||
+ .sun4i_i2s_regmap = &sun4i_i2s_regmap_config,
|
||||
+ .has_slave_select_bit = true,
|
||||
+ .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7),
|
||||
+ .field_fmt_wss = REG_FIELD(SUN4I_I2S_FMT0_REG, 2, 3),
|
||||
+ .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5),
|
||||
+ .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6),
|
||||
+ .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7),
|
||||
+ .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1),
|
||||
+ .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31),
|
||||
+ .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31),
|
||||
+ .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2),
|
||||
+ .field_rxchansel = REG_FIELD(SUN4I_I2S_RX_CHAN_SEL_REG, 0, 2),
|
||||
+};
|
||||
+
|
||||
static int sun4i_i2s_init_regmap_fields(struct device *dev,
|
||||
struct sun4i_i2s *i2s)
|
||||
{
|
||||
@@ -1158,6 +1175,10 @@ static const struct of_device_id sun4i_i2s_match[] = {
|
||||
.compatible = "allwinner,sun8i-h3-i2s",
|
||||
.data = &sun8i_h3_i2s_quirks,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "allwinner,sun50i-a64-codec-i2s",
|
||||
+ .data = &sun50i_a64_codec_i2s_quirks,
|
||||
+ },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun4i_i2s_match);
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,505 +0,0 @@
|
|||
From 010a2d4736116f5464898c3118637a18a214281b Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Thu, 11 Oct 2018 23:07:40 -0700
|
||||
Subject: [PATCH 118/146] ASoC: sunxi: Add new driver for Allwinner A64 codec's
|
||||
analog path controls
|
||||
|
||||
The internal codec on A64 is split into 2 parts. The analog path controls
|
||||
are routed through an embedded custom register bus accessed through
|
||||
the PRCM block.
|
||||
|
||||
Add an ASoC component driver for it. This should be tied to the codec
|
||||
audio card as an auxiliary device.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
sound/soc/sunxi/Kconfig | 8 +
|
||||
sound/soc/sunxi/Makefile | 1 +
|
||||
sound/soc/sunxi/sun50i-codec-analog.c | 444 ++++++++++++++++++++++++++
|
||||
3 files changed, 453 insertions(+)
|
||||
create mode 100644 sound/soc/sunxi/sun50i-codec-analog.c
|
||||
|
||||
diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
|
||||
index 83b770cdfdaa..8a055ca1819a 100644
|
||||
--- a/sound/soc/sunxi/Kconfig
|
||||
+++ b/sound/soc/sunxi/Kconfig
|
||||
@@ -28,6 +28,14 @@ config SND_SUN8I_CODEC_ANALOG
|
||||
Say Y or M if you want to add support for the analog controls for
|
||||
the codec embedded in newer Allwinner SoCs.
|
||||
|
||||
+config SND_SUN50I_CODEC_ANALOG
|
||||
+ tristate "Allwinner sun50i Codec Analog Controls Support"
|
||||
+ depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
|
||||
+ select SND_SUNXI_ADDA_PR_REGMAP
|
||||
+ help
|
||||
+ Say Y or M if you want to add support for the analog controls for
|
||||
+ the codec embedded in Allwinner A64 SoC.
|
||||
+
|
||||
config SND_SUN4I_I2S
|
||||
tristate "Allwinner A10 I2S Support"
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
|
||||
index 74b99d55cfca..a86be340a076 100644
|
||||
--- a/sound/soc/sunxi/Makefile
|
||||
+++ b/sound/soc/sunxi/Makefile
|
||||
@@ -3,5 +3,6 @@ obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
|
||||
obj-$(CONFIG_SND_SUN4I_I2S) += sun4i-i2s.o
|
||||
obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
|
||||
obj-$(CONFIG_SND_SUN8I_CODEC_ANALOG) += sun8i-codec-analog.o
|
||||
+obj-$(CONFIG_SND_SUN50I_CODEC_ANALOG) += sun50i-codec-analog.o
|
||||
obj-$(CONFIG_SND_SUN8I_CODEC) += sun8i-codec.o
|
||||
obj-$(CONFIG_SND_SUN8I_ADDA_PR_REGMAP) += sun8i-adda-pr-regmap.o
|
||||
diff --git a/sound/soc/sunxi/sun50i-codec-analog.c b/sound/soc/sunxi/sun50i-codec-analog.c
|
||||
new file mode 100644
|
||||
index 000000000000..8f5f999df631
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
|
||||
@@ -0,0 +1,444 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * This driver supports the analog controls for the internal codec
|
||||
+ * found in Allwinner's A64 SoC.
|
||||
+ *
|
||||
+ * Copyright (C) 2016 Chen-Yu Tsai <wens@csie.org>
|
||||
+ * Copyright (C) 2017 Marcus Cooper <codekipper@gmail.com>
|
||||
+ * Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
+ *
|
||||
+ * Based on sun8i-codec-analog.c
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_device.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/regmap.h>
|
||||
+
|
||||
+#include <sound/soc.h>
|
||||
+#include <sound/soc-dapm.h>
|
||||
+#include <sound/tlv.h>
|
||||
+
|
||||
+#include "sun8i-adda-pr-regmap.h"
|
||||
+
|
||||
+/* Codec analog control register offsets and bit fields */
|
||||
+#define SUN50I_ADDA_HP_CTRL 0x00
|
||||
+#define SUN50I_ADDA_HP_CTRL_PA_CLK_GATE 7
|
||||
+#define SUN50I_ADDA_HP_CTRL_HPPA_EN 6
|
||||
+#define SUN50I_ADDA_HP_CTRL_HPVOL 0
|
||||
+
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL 0x01
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_MIC1 6
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_MIC2 5
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_PHONE 4
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_PHONEN 3
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_LINEINL 2
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_DACL 1
|
||||
+#define SUN50I_ADDA_OL_MIX_CTRL_DACR 0
|
||||
+
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL 0x02
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_MIC1 6
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_MIC2 5
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_PHONE 4
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_PHONEP 3
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_LINEINR 2
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_DACR 1
|
||||
+#define SUN50I_ADDA_OR_MIX_CTRL_DACL 0
|
||||
+
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL0 0x05
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL0_LEN 7
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL0_REN 6
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL0_LSRC_SEL 5
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL0_RSRC_SEL 4
|
||||
+
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL1 0x06
|
||||
+#define SUN50I_ADDA_LINEOUT_CTRL1_VOL 0
|
||||
+
|
||||
+#define SUN50I_ADDA_MIC1_CTRL 0x07
|
||||
+#define SUN50I_ADDA_MIC1_CTRL_MIC1G 4
|
||||
+#define SUN50I_ADDA_MIC1_CTRL_MIC1AMPEN 3
|
||||
+#define SUN50I_ADDA_MIC1_CTRL_MIC1BOOST 0
|
||||
+
|
||||
+#define SUN50I_ADDA_MIC2_CTRL 0x08
|
||||
+#define SUN50I_ADDA_MIC2_CTRL_MIC2G 4
|
||||
+#define SUN50I_ADDA_MIC2_CTRL_MIC2AMPEN 3
|
||||
+#define SUN50I_ADDA_MIC2_CTRL_MIC2BOOST 0
|
||||
+
|
||||
+#define SUN50I_ADDA_LINEIN_CTRL 0x09
|
||||
+#define SUN50I_ADDA_LINEIN_CTRL_LINEING 0
|
||||
+
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL 0x0a
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_DACAREN 7
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_DACALEN 6
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_RMIXEN 5
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_LMIXEN 4
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE 3
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE 2
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_RHPIS 1
|
||||
+#define SUN50I_ADDA_MIX_DAC_CTRL_LHPIS 0
|
||||
+
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC 0x0b
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_MIC1 6
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_MIC2 5
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_PHONE 4
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_PHONEN 3
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_LINEINL 2
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_OMIXRL 1
|
||||
+#define SUN50I_ADDA_L_ADCMIX_SRC_OMIXRR 0
|
||||
+
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC 0x0c
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_MIC1 6
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_MIC2 5
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_PHONE 4
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_PHONEP 3
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_LINEINR 2
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_OMIXR 1
|
||||
+#define SUN50I_ADDA_R_ADCMIX_SRC_OMIXL 0
|
||||
+
|
||||
+#define SUN50I_ADDA_ADC_CTRL 0x0d
|
||||
+#define SUN50I_ADDA_ADC_CTRL_ADCREN 7
|
||||
+#define SUN50I_ADDA_ADC_CTRL_ADCLEN 6
|
||||
+#define SUN50I_ADDA_ADC_CTRL_ADCG 0
|
||||
+
|
||||
+#define SUN50I_ADDA_HS_MBIAS_CTRL 0x0e
|
||||
+#define SUN50I_ADDA_HS_MBIAS_CTRL_MMICBIASEN 7
|
||||
+
|
||||
+#define SUN50I_ADDA_JACK_MIC_CTRL 0x1d
|
||||
+#define SUN50I_ADDA_JACK_MIC_CTRL_HMICBIASEN 5
|
||||
+
|
||||
+/* mixer controls */
|
||||
+static const struct snd_kcontrol_new sun50i_a64_codec_mixer_controls[] = {
|
||||
+ SOC_DAPM_DOUBLE_R("DAC Playback Switch",
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OR_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL_DACL, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("DAC Reversed Playback Switch",
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OR_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL_DACR, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Line In Playback Switch",
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OR_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL_LINEINL, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Mic1 Playback Switch",
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OR_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL_MIC1, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Mic2 Playback Switch",
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OR_MIX_CTRL,
|
||||
+ SUN50I_ADDA_OL_MIX_CTRL_MIC2, 1, 0),
|
||||
+};
|
||||
+
|
||||
+/* ADC mixer controls */
|
||||
+static const struct snd_kcontrol_new sun50i_codec_adc_mixer_controls[] = {
|
||||
+ SOC_DAPM_DOUBLE_R("Mixer Capture Switch",
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_R_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC_OMIXRL, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Mixer Reversed Capture Switch",
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_R_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC_OMIXRR, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Line In Capture Switch",
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_R_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC_LINEINL, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Mic1 Capture Switch",
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_R_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC_MIC1, 1, 0),
|
||||
+ SOC_DAPM_DOUBLE_R("Mic2 Capture Switch",
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_R_ADCMIX_SRC,
|
||||
+ SUN50I_ADDA_L_ADCMIX_SRC_MIC2, 1, 0),
|
||||
+};
|
||||
+
|
||||
+static const DECLARE_TLV_DB_SCALE(sun50i_codec_out_mixer_pregain_scale,
|
||||
+ -450, 150, 0);
|
||||
+static const DECLARE_TLV_DB_RANGE(sun50i_codec_mic_gain_scale,
|
||||
+ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
|
||||
+ 1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0),
|
||||
+);
|
||||
+
|
||||
+static const DECLARE_TLV_DB_SCALE(sun50i_codec_hp_vol_scale, -6300, 100, 1);
|
||||
+
|
||||
+static const DECLARE_TLV_DB_RANGE(sun50i_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),
|
||||
+);
|
||||
+
|
||||
+
|
||||
+/* volume / mute controls */
|
||||
+static const struct snd_kcontrol_new sun50i_a64_codec_controls[] = {
|
||||
+ SOC_SINGLE_TLV("Headphone Playback Volume",
|
||||
+ SUN50I_ADDA_HP_CTRL,
|
||||
+ SUN50I_ADDA_HP_CTRL_HPVOL, 0x3f, 0,
|
||||
+ sun50i_codec_hp_vol_scale),
|
||||
+
|
||||
+ SOC_DOUBLE("Headphone Playback Switch",
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE, 1, 0),
|
||||
+
|
||||
+ /* Mixer pre-gain */
|
||||
+ SOC_SINGLE_TLV("Mic1 Playback Volume", SUN50I_ADDA_MIC1_CTRL,
|
||||
+ SUN50I_ADDA_MIC1_CTRL_MIC1G,
|
||||
+ 0x7, 0, sun50i_codec_out_mixer_pregain_scale),
|
||||
+
|
||||
+ /* Microphone Amp boost gain */
|
||||
+ SOC_SINGLE_TLV("Mic1 Boost Volume", SUN50I_ADDA_MIC1_CTRL,
|
||||
+ SUN50I_ADDA_MIC1_CTRL_MIC1BOOST, 0x7, 0,
|
||||
+ sun50i_codec_mic_gain_scale),
|
||||
+
|
||||
+ /* Mixer pre-gain */
|
||||
+ SOC_SINGLE_TLV("Mic2 Playback Volume",
|
||||
+ SUN50I_ADDA_MIC2_CTRL, SUN50I_ADDA_MIC2_CTRL_MIC2G,
|
||||
+ 0x7, 0, sun50i_codec_out_mixer_pregain_scale),
|
||||
+
|
||||
+ /* Microphone Amp boost gain */
|
||||
+ SOC_SINGLE_TLV("Mic2 Boost Volume", SUN50I_ADDA_MIC2_CTRL,
|
||||
+ SUN50I_ADDA_MIC2_CTRL_MIC2BOOST, 0x7, 0,
|
||||
+ sun50i_codec_mic_gain_scale),
|
||||
+
|
||||
+ /* ADC */
|
||||
+ SOC_SINGLE_TLV("ADC Gain Capture Volume", SUN50I_ADDA_ADC_CTRL,
|
||||
+ SUN50I_ADDA_ADC_CTRL_ADCG, 0x7, 0,
|
||||
+ sun50i_codec_out_mixer_pregain_scale),
|
||||
+
|
||||
+ /* Mixer pre-gain */
|
||||
+ SOC_SINGLE_TLV("Line In Playback Volume", SUN50I_ADDA_LINEIN_CTRL,
|
||||
+ SUN50I_ADDA_LINEIN_CTRL_LINEING,
|
||||
+ 0x7, 0, sun50i_codec_out_mixer_pregain_scale),
|
||||
+
|
||||
+ SOC_SINGLE_TLV("Line Out Playback Volume",
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL1,
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL1_VOL, 0x1f, 0,
|
||||
+ sun50i_codec_lineout_vol_scale),
|
||||
+
|
||||
+ SOC_DOUBLE("Line Out Playback Switch",
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL0,
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL0_LEN,
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL0_REN, 1, 0),
|
||||
+
|
||||
+};
|
||||
+
|
||||
+static const char * const sun50i_codec_hp_src_enum_text[] = {
|
||||
+ "DAC", "Mixer",
|
||||
+};
|
||||
+
|
||||
+static SOC_ENUM_DOUBLE_DECL(sun50i_codec_hp_src_enum,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_LHPIS,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_RHPIS,
|
||||
+ sun50i_codec_hp_src_enum_text);
|
||||
+
|
||||
+static const struct snd_kcontrol_new sun50i_codec_hp_src[] = {
|
||||
+ SOC_DAPM_ENUM("Headphone Source Playback Route",
|
||||
+ sun50i_codec_hp_src_enum),
|
||||
+};
|
||||
+
|
||||
+static const char * const sun50i_codec_lineout_src_enum_text[] = {
|
||||
+ "Stereo", "Mono Differential",
|
||||
+};
|
||||
+
|
||||
+static SOC_ENUM_DOUBLE_DECL(sun50i_codec_lineout_src_enum,
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL0,
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL0_LSRC_SEL,
|
||||
+ SUN50I_ADDA_LINEOUT_CTRL0_RSRC_SEL,
|
||||
+ sun50i_codec_lineout_src_enum_text);
|
||||
+
|
||||
+static const struct snd_kcontrol_new sun50i_codec_lineout_src[] = {
|
||||
+ SOC_DAPM_ENUM("Line Out Source Playback Route",
|
||||
+ sun50i_codec_lineout_src_enum),
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_dapm_widget sun50i_a64_codec_widgets[] = {
|
||||
+ /* DAC */
|
||||
+ SND_SOC_DAPM_DAC("Left DAC", NULL, SUN50I_ADDA_MIX_DAC_CTRL,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_DACALEN, 0),
|
||||
+ SND_SOC_DAPM_DAC("Right DAC", NULL, SUN50I_ADDA_MIX_DAC_CTRL,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_DACAREN, 0),
|
||||
+ /* ADC */
|
||||
+ SND_SOC_DAPM_ADC("Left ADC", NULL, SUN50I_ADDA_ADC_CTRL,
|
||||
+ SUN50I_ADDA_ADC_CTRL_ADCLEN, 0),
|
||||
+ SND_SOC_DAPM_ADC("Right ADC", NULL, SUN50I_ADDA_ADC_CTRL,
|
||||
+ SUN50I_ADDA_ADC_CTRL_ADCREN, 0),
|
||||
+ /*
|
||||
+ * Due to this component and the codec belonging to separate DAPM
|
||||
+ * contexts, we need to manually link the above widgets to their
|
||||
+ * stream widgets at the card level.
|
||||
+ */
|
||||
+
|
||||
+ SND_SOC_DAPM_MUX("Headphone Source Playback Route",
|
||||
+ SND_SOC_NOPM, 0, 0, sun50i_codec_hp_src),
|
||||
+ SND_SOC_DAPM_OUT_DRV("Headphone Amp", SUN50I_ADDA_HP_CTRL,
|
||||
+ SUN50I_ADDA_HP_CTRL_HPPA_EN, 0, NULL, 0),
|
||||
+ SND_SOC_DAPM_OUTPUT("HP"),
|
||||
+
|
||||
+ SND_SOC_DAPM_MUX("Line Out Source Playback Route",
|
||||
+ SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
|
||||
+ SND_SOC_DAPM_OUTPUT("LINEOUT"),
|
||||
+
|
||||
+ /* Microphone inputs */
|
||||
+ SND_SOC_DAPM_INPUT("MIC1"),
|
||||
+
|
||||
+ /* Microphone Bias */
|
||||
+ SND_SOC_DAPM_SUPPLY("MBIAS", SUN50I_ADDA_HS_MBIAS_CTRL,
|
||||
+ SUN50I_ADDA_HS_MBIAS_CTRL_MMICBIASEN,
|
||||
+ 0, NULL, 0),
|
||||
+
|
||||
+ /* Mic input path */
|
||||
+ SND_SOC_DAPM_PGA("Mic1 Amplifier", SUN50I_ADDA_MIC1_CTRL,
|
||||
+ SUN50I_ADDA_MIC1_CTRL_MIC1AMPEN, 0, NULL, 0),
|
||||
+
|
||||
+ /* Microphone input */
|
||||
+ SND_SOC_DAPM_INPUT("MIC2"),
|
||||
+
|
||||
+ /* Microphone Bias */
|
||||
+ SND_SOC_DAPM_SUPPLY("HBIAS", SUN50I_ADDA_JACK_MIC_CTRL,
|
||||
+ SUN50I_ADDA_JACK_MIC_CTRL_HMICBIASEN,
|
||||
+ 0, NULL, 0),
|
||||
+
|
||||
+ /* Mic input path */
|
||||
+ SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN50I_ADDA_MIC2_CTRL,
|
||||
+ SUN50I_ADDA_MIC2_CTRL_MIC2AMPEN, 0, NULL, 0),
|
||||
+
|
||||
+ /* Line input */
|
||||
+ SND_SOC_DAPM_INPUT("LINEIN"),
|
||||
+
|
||||
+ /* Mixers */
|
||||
+ SND_SOC_DAPM_MIXER("Left Mixer", SUN50I_ADDA_MIX_DAC_CTRL,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_LMIXEN, 0,
|
||||
+ sun50i_a64_codec_mixer_controls,
|
||||
+ ARRAY_SIZE(sun50i_a64_codec_mixer_controls)),
|
||||
+ SND_SOC_DAPM_MIXER("Right Mixer", SUN50I_ADDA_MIX_DAC_CTRL,
|
||||
+ SUN50I_ADDA_MIX_DAC_CTRL_RMIXEN, 0,
|
||||
+ sun50i_a64_codec_mixer_controls,
|
||||
+ ARRAY_SIZE(sun50i_a64_codec_mixer_controls)),
|
||||
+ SND_SOC_DAPM_MIXER("Left ADC Mixer", SUN50I_ADDA_ADC_CTRL,
|
||||
+ SUN50I_ADDA_ADC_CTRL_ADCLEN, 0,
|
||||
+ sun50i_codec_adc_mixer_controls,
|
||||
+ ARRAY_SIZE(sun50i_codec_adc_mixer_controls)),
|
||||
+ SND_SOC_DAPM_MIXER("Right ADC Mixer", SUN50I_ADDA_ADC_CTRL,
|
||||
+ SUN50I_ADDA_ADC_CTRL_ADCREN, 0,
|
||||
+ sun50i_codec_adc_mixer_controls,
|
||||
+ ARRAY_SIZE(sun50i_codec_adc_mixer_controls)),
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_dapm_route sun50i_a64_codec_routes[] = {
|
||||
+ /* Left Mixer Routes */
|
||||
+ { "Left Mixer", "DAC Playback Switch", "Left DAC" },
|
||||
+ { "Left Mixer", "DAC Reversed Playback Switch", "Right DAC" },
|
||||
+ { "Left Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
|
||||
+
|
||||
+ /* Right Mixer Routes */
|
||||
+ { "Right Mixer", "DAC Playback Switch", "Right DAC" },
|
||||
+ { "Right Mixer", "DAC Reversed Playback Switch", "Left DAC" },
|
||||
+ { "Right Mixer", "Mic1 Playback Switch", "Mic1 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", "Mic1 Capture Switch", "Mic1 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", "Mic1 Capture Switch", "Mic1 Amplifier" },
|
||||
+
|
||||
+ /* ADC Routes */
|
||||
+ { "Left ADC", NULL, "Left ADC Mixer" },
|
||||
+ { "Right ADC", NULL, "Right ADC Mixer" },
|
||||
+
|
||||
+ /* Headphone Routes */
|
||||
+ { "Headphone Source Playback Route", "DAC", "Left DAC" },
|
||||
+ { "Headphone Source Playback Route", "DAC", "Right DAC" },
|
||||
+ { "Headphone Source Playback Route", "Mixer", "Left Mixer" },
|
||||
+ { "Headphone Source Playback Route", "Mixer", "Right Mixer" },
|
||||
+ { "Headphone Amp", NULL, "Headphone Source Playback Route" },
|
||||
+ { "HP", NULL, "Headphone Amp" },
|
||||
+
|
||||
+ /* Microphone Routes */
|
||||
+ { "Mic1 Amplifier", NULL, "MIC1"},
|
||||
+
|
||||
+ /* Microphone Routes */
|
||||
+ { "Mic2 Amplifier", NULL, "MIC2"},
|
||||
+ { "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
|
||||
+ { "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
|
||||
+ { "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
|
||||
+ { "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
|
||||
+
|
||||
+ /* Line-in Routes */
|
||||
+ { "Left Mixer", "Line In Playback Switch", "LINEIN" },
|
||||
+ { "Right Mixer", "Line In Playback Switch", "LINEIN" },
|
||||
+ { "Left ADC Mixer", "Line In Capture Switch", "LINEIN" },
|
||||
+ { "Right ADC Mixer", "Line In Capture Switch", "LINEIN" },
|
||||
+
|
||||
+ /* 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" },
|
||||
+ { "Line Out Source Playback Route", "Mono Differential",
|
||||
+ "Right Mixer" },
|
||||
+ { "LINEOUT", NULL, "Line Out Source Playback Route" },
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = {
|
||||
+ .controls = sun50i_a64_codec_controls,
|
||||
+ .num_controls = ARRAY_SIZE(sun50i_a64_codec_controls),
|
||||
+ .dapm_widgets = sun50i_a64_codec_widgets,
|
||||
+ .num_dapm_widgets = ARRAY_SIZE(sun50i_a64_codec_widgets),
|
||||
+ .dapm_routes = sun50i_a64_codec_routes,
|
||||
+ .num_dapm_routes = ARRAY_SIZE(sun50i_a64_codec_routes),
|
||||
+};
|
||||
+
|
||||
+static const struct of_device_id sun50i_codec_analog_of_match[] = {
|
||||
+ {
|
||||
+ .compatible = "allwinner,sun50i-a64-codec-analog",
|
||||
+ },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, sun50i_codec_analog_of_match);
|
||||
+
|
||||
+static int sun50i_codec_analog_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ struct regmap *regmap;
|
||||
+ void __iomem *base;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(base)) {
|
||||
+ dev_err(&pdev->dev, "Failed to map the registers\n");
|
||||
+ return PTR_ERR(base);
|
||||
+ }
|
||||
+
|
||||
+ regmap = sun8i_adda_pr_regmap_init(&pdev->dev, base);
|
||||
+ if (IS_ERR(regmap)) {
|
||||
+ dev_err(&pdev->dev, "Failed to create regmap\n");
|
||||
+ return PTR_ERR(regmap);
|
||||
+ }
|
||||
+
|
||||
+ return devm_snd_soc_register_component(&pdev->dev,
|
||||
+ &sun50i_codec_analog_cmpnt_drv,
|
||||
+ NULL, 0);
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver sun50i_codec_analog_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "sun50i-codec-analog",
|
||||
+ .of_match_table = sun50i_codec_analog_of_match,
|
||||
+ },
|
||||
+ .probe = sun50i_codec_analog_probe,
|
||||
+};
|
||||
+module_platform_driver(sun50i_codec_analog_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Allwinner internal codec analog controls driver for A64");
|
||||
+MODULE_AUTHOR("Vasily Khoruzhick <anarsoul@gmail.com>");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_ALIAS("platform:sun50i-codec-analog");
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
From b66aa83817ae94f594e1c1505127530190ef4eba Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Fri, 12 Oct 2018 23:54:55 -0700
|
||||
Subject: [PATCH 119/146] ASoC: sunxi: allow the sun8i-codec driver to be built
|
||||
on ARM64
|
||||
|
||||
Allwinner A64 uses the same digital codec part as in A33, so we need
|
||||
to build this driver on ARM64 as well.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
sound/soc/sunxi/Kconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
|
||||
index 8a055ca1819a..66aad0d3f9c7 100644
|
||||
--- a/sound/soc/sunxi/Kconfig
|
||||
+++ b/sound/soc/sunxi/Kconfig
|
||||
@@ -12,7 +12,7 @@ config SND_SUN4I_CODEC
|
||||
config SND_SUN8I_CODEC
|
||||
tristate "Allwinner SUN8I audio codec"
|
||||
depends on OF
|
||||
- depends on MACH_SUN8I || COMPILE_TEST
|
||||
+ depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST
|
||||
select REGMAP_MMIO
|
||||
help
|
||||
This option enables the digital part of the internal audio codec for
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue