sun8i-r40-audio-codec (#4021)
This commit is contained in:
parent
6f0837231c
commit
0ddf255a7c
@ -0,0 +1,29 @@
|
||||
diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
index d5ad3b9efd12..7a0b72304da5 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
@@ -680,6 +680,24 @@ ir1: ir@1c21c00 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ codec: codec@1c22c00 {
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ compatible = "allwinner,sun8i-r40-codec";
|
||||
+ reg = <0x01c22c00 0x300>;
|
||||
+ interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_CODEC>;
|
||||
+ clock-names = "apb", "codec";
|
||||
+ resets = <&ccu RST_BUS_CODEC>;
|
||||
+ dmas = <&dma 19>, <&dma 19>;
|
||||
+ dma-names = "rx", "tx";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ codec_analog: codec-analog@1c22f00 {
|
||||
+ compatible = "allwinner,sun8i-r40-codec-analog";
|
||||
+ reg = <0x01c22f00 0x4>;
|
||||
+ };
|
||||
+
|
||||
ths: thermal-sensor@1c24c00 {
|
||||
compatible = "allwinner,sun8i-r40-ths";
|
||||
reg = <0x01c24c00 0x100>;
|
||||
@ -1,63 +0,0 @@
|
||||
From c42403109d01c176ce425083b08303c46961e822 Mon Sep 17 00:00:00 2001
|
||||
From: The-going <48602507+The-going@users.noreply.github.com>
|
||||
Date: Tue, 25 Jan 2022 21:18:21 +0300
|
||||
Subject: [PATCH 101/101] arm:dts: sun8i-r40 bananapi-m2-ultra add codec analog
|
||||
|
||||
---
|
||||
.../boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 10 ++++++++++
|
||||
arch/arm/boot/dts/sun8i-r40.dtsi | 18 ++++++++++++++++++
|
||||
2 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
index 87cf03574..73370f20d 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
@@ -113,6 +113,16 @@ &ahci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&codec {
|
||||
+ allwinner,audio-routing =
|
||||
+ "Headphone", "HP",
|
||||
+ "Headphone", "HPCOM",
|
||||
+ "MIC1", "Mic",
|
||||
+ "Mic", "MBIAS";
|
||||
+ allwinner,codec-analog-controls = <&codec_analog>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
index 4f42e3c4b..5bb6e1530 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
@@ -800,6 +800,24 @@ ths: thermal-sensor@1c24c00 {
|
||||
#thermal-sensor-cells = <1>;
|
||||
};
|
||||
|
||||
+ codec: codec@1c22c00 {
|
||||
+ #sound-dai-cells = <1>;
|
||||
+ compatible = "allwinner,sun8i-h3-codec";
|
||||
+ reg = <0x01c22c00 0x300>;
|
||||
+ interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_CODEC>;
|
||||
+ clock-names = "apb", "codec";
|
||||
+ resets = <&ccu RST_BUS_CODEC>;
|
||||
+ dmas = <&dma 19>, <&dma 19>;
|
||||
+ dma-names = "rx", "tx";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ codec_analog: codec-analog@1c22f00 {
|
||||
+ compatible = "allwinner,sun8i-a23-codec-analog";
|
||||
+ reg = <0x01c22f00 0x4>;
|
||||
+ };
|
||||
+
|
||||
uart0: serial@1c28000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0x01c28000 0x400>;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
index a6a1087a0c9b..3ad67d12cb9f 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
@@ -113,6 +113,16 @@ &ahci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&codec {
|
||||
+ allwinner,audio-routing =
|
||||
+ "Headphone", "HP",
|
||||
+ "Headphone", "HPCOM",
|
||||
+ "MIC1", "Mic",
|
||||
+ "Mic", "MBIAS";
|
||||
+ allwinner,codec-analog-controls = <&codec_analog>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
@ -0,0 +1,21 @@
|
||||
diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
|
||||
index 47954551f573..781f294c98aa 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
|
||||
@@ -107,6 +107,16 @@ &ahci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&codec {
|
||||
+ allwinner,audio-routing =
|
||||
+ "Headphone", "HP",
|
||||
+ "Headphone", "HPCOM",
|
||||
+ "MIC1", "Mic",
|
||||
+ "Mic", "MBIAS";
|
||||
+ allwinner,codec-analog-controls = <&codec_analog>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
@ -0,0 +1,97 @@
|
||||
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
|
||||
index da597e456beb..b99727edcb0e 100644
|
||||
--- a/sound/soc/sunxi/sun4i-codec.c
|
||||
+++ b/sound/soc/sunxi/sun4i-codec.c
|
||||
@@ -1507,6 +1507,45 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev)
|
||||
return card;
|
||||
};
|
||||
|
||||
+static struct snd_soc_card *sun8i_r40_codec_create_card(struct device *dev)
|
||||
+{
|
||||
+ struct snd_soc_card *card;
|
||||
+ int ret;
|
||||
+
|
||||
+ card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
|
||||
+ if (!card)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ aux_dev.dlc.of_node = of_parse_phandle(dev->of_node,
|
||||
+ "allwinner,codec-analog-controls",
|
||||
+ 0);
|
||||
+ if (!aux_dev.dlc.of_node) {
|
||||
+ dev_err(dev, "Can't find analog controls for codec.\n");
|
||||
+ return ERR_PTR(-EINVAL);
|
||||
+ }
|
||||
+
|
||||
+ card->dai_link = sun4i_codec_create_link(dev, &card->num_links);
|
||||
+ if (!card->dai_link)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ card->dev = dev;
|
||||
+ card->owner = THIS_MODULE;
|
||||
+ card->name = "R40 Audio Codec";
|
||||
+ card->dapm_widgets = sun6i_codec_card_dapm_widgets;
|
||||
+ card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
|
||||
+ card->dapm_routes = sun8i_codec_card_routes;
|
||||
+ card->num_dapm_routes = ARRAY_SIZE(sun8i_codec_card_routes);
|
||||
+ card->aux_dev = &aux_dev;
|
||||
+ card->num_aux_devs = 1;
|
||||
+ card->fully_routed = true;
|
||||
+
|
||||
+ ret = snd_soc_of_parse_audio_routing(card, "allwinner,audio-routing");
|
||||
+ if (ret)
|
||||
+ dev_warn(dev, "failed to parse audio-routing: %d\n", ret);
|
||||
+
|
||||
+ return card;
|
||||
+};
|
||||
+
|
||||
static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev)
|
||||
{
|
||||
struct snd_soc_card *card;
|
||||
@@ -1581,6 +1620,13 @@ static const struct regmap_config sun8i_h3_codec_regmap_config = {
|
||||
.max_register = SUN8I_H3_CODEC_ADC_DBG,
|
||||
};
|
||||
|
||||
+static const struct regmap_config sun8i_r40_codec_regmap_config = {
|
||||
+ .reg_bits = 32,
|
||||
+ .reg_stride = 4,
|
||||
+ .val_bits = 32,
|
||||
+ .max_register = SUN8I_H3_CODEC_ADC_DBG,
|
||||
+};
|
||||
+
|
||||
static const struct regmap_config sun8i_v3s_codec_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
@@ -1651,6 +1697,21 @@ static const struct sun4i_codec_quirks sun8i_h3_codec_quirks = {
|
||||
.has_reset = true,
|
||||
};
|
||||
|
||||
+static const struct sun4i_codec_quirks sun8i_r40_codec_quirks = {
|
||||
+ .regmap_config = &sun8i_r40_codec_regmap_config,
|
||||
+ /*
|
||||
+ * TODO Share the codec structure with A23 for now.
|
||||
+ * This should be split out when adding digital audio
|
||||
+ * processing support for the H3.
|
||||
+ */
|
||||
+ .codec = &sun8i_a23_codec_codec,
|
||||
+ .create_card = sun8i_r40_codec_create_card,
|
||||
+ .reg_adc_fifoc = REG_FIELD(SUN6I_CODEC_ADC_FIFOC, 0, 31),
|
||||
+ .reg_dac_txdata = SUN8I_H3_CODEC_DAC_TXDATA,
|
||||
+ .reg_adc_rxdata = SUN6I_CODEC_ADC_RXDATA,
|
||||
+ .has_reset = true,
|
||||
+};
|
||||
+
|
||||
static const struct sun4i_codec_quirks sun8i_v3s_codec_quirks = {
|
||||
.regmap_config = &sun8i_v3s_codec_regmap_config,
|
||||
/*
|
||||
@@ -1686,6 +1747,10 @@ static const struct of_device_id sun4i_codec_of_match[] = {
|
||||
.compatible = "allwinner,sun8i-h3-codec",
|
||||
.data = &sun8i_h3_codec_quirks,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "allwinner,sun8i-r40-codec",
|
||||
+ .data = &sun8i_r40_codec_quirks,
|
||||
+ },
|
||||
{
|
||||
.compatible = "allwinner,sun8i-v3s-codec",
|
||||
.data = &sun8i_v3s_codec_quirks,
|
||||
@ -0,0 +1,30 @@
|
||||
diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
|
||||
index be872eefa61e..fa5493e8d250 100644
|
||||
--- a/sound/soc/sunxi/sun8i-codec-analog.c
|
||||
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
|
||||
@@ -686,6 +686,14 @@ static const struct sun8i_codec_analog_quirks sun8i_h3_quirks = {
|
||||
.has_mic2 = true,
|
||||
};
|
||||
|
||||
+static const struct sun8i_codec_analog_quirks sun8i_r40_quirks = {
|
||||
+ .has_headphone = true,
|
||||
+ .has_hmic = true,
|
||||
+ .has_linein = true,
|
||||
+ .has_mbias = true,
|
||||
+ .has_mic2 = true,
|
||||
+};
|
||||
+
|
||||
static int sun8i_codec_analog_add_mixer(struct snd_soc_component *cmpnt,
|
||||
const struct sun8i_codec_analog_quirks *quirks)
|
||||
{
|
||||
@@ -809,6 +817,10 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = {
|
||||
.compatible = "allwinner,sun8i-h3-codec-analog",
|
||||
.data = &sun8i_h3_quirks,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "allwinner,sun8i-r40-codec-analog",
|
||||
+ .data = &sun8i_r40_quirks,
|
||||
+ },
|
||||
{
|
||||
.compatible = "allwinner,sun8i-v3s-codec-analog",
|
||||
.data = &sun8i_v3s_quirks,
|
||||
@ -560,7 +560,7 @@
|
||||
patches.armbian/arm-dts-h3-nanopi-neo-Add-regulator-leds-mmc2.patch
|
||||
patches.armbian/arm-dts-h3-nanopi-neo-air-Add-regulator-camera-wifi-.patch
|
||||
patches.armbian/arm-dts-h3-orangepi-2-Add-regulator-vdd-cpu.patch
|
||||
patches.armbian/arm-dts-sun8i-r40-bananapi-m2-ultra-add-codec-analog.patch
|
||||
- patches.armbian/arm-dts-sun8i-r40-bananapi-m2-ultra-add-codec-analog.patch
|
||||
patches.armbian/arm-dts-sun7i-a20-cubietruck-add-alias-uart2.patch
|
||||
patches.armbian/arm-dts-sun8i-v3s-s3-pinecube-enable-sound-codec.patch
|
||||
patches.armbian/arm-dts-sun8i-r40-add-clk_out_a-fix-bananam2ultra.patch
|
||||
@ -675,3 +675,8 @@
|
||||
patches.armbian/0014-add-uwe-bsp-to-orangepi3-lts-dts-file.patch
|
||||
patches.armbian/999-rollback-rsb.patch
|
||||
patches.armbian/Orangepi_one_plus_Rollback-r_rsb-to-r_i2c.patch
|
||||
patches.armbian/sound-soc-sunxi-sun4i-codec-add-r40.patch
|
||||
patches.armbian/sound-soc-sunxi-sun8i-codec-analog-add-r40.patch
|
||||
patches.armbian/arm-dts-sun8i-r40-add-nodes-for-audio-codec.patch
|
||||
patches.armbian/arm-dts-sun8i-r40-bananapi-m2-ultra-enable-audio-codec.patch
|
||||
patches.armbian/arm-dts-sun8i-v40-bananapi-m2-berry-enable-audio-codec.patch
|
||||
|
||||
Loading…
Reference in New Issue
Block a user