Skip to contentSkip to conversation

ASoC: Some issues about loongson i2s

PATCH In review Binbin Zhou 4 participants 15 messages Oct 9, 2024 – Oct 10, 2024

Subsystems (5)
lore
Share & tools
lore

Binbin Zhou

author maintainer
#0 lore raw

v3 cover ASoC: Some issues about loongson i2s

Hi all:

This patch set is mainly about Loongson i2s related issues.

Please allow me to briefly explain this patch set:
Patch 1-2: Add ES8323 codec required on Loongson-2K2000 Patch 3-4: Add uda1342 codec required on Loongson-2K1000 Patch 5: Fix the problem of unable to detect codec under FDT system. Patch 6-7: Add Loongson i2s platform device support
Patch 8-9: Related DTS support.

Thanks.

-------
V3:
patch (1/9)/(6/9):
- Add Reviewed-by tag from Rob;

patch (2/9):
- Use C++ style for the comment block at the head of file;
- Add DAI format config accroding datasheet.

patch (4/9):
- Use C++ style for the comment block at the head of file;
- Drop some noisy log message(dev_info);
- Drop unused variable reported by lkp.

patch (5/9):
- Reuse snd_soc_of_get_dlc() helper function;
- Set the value of snd_soc_dai_link.platforms to avoid check failed.

patch (7/9):
- Use C++ style for the comment block at the head of file;
- Rewrite the dependency between the card and the DAI driver, we will select from the card to the DAI driver;

Link to V2:
https://lore.kernel.org/all/[email protected]/

V2:
- Spilt the improve code readability patch to a separate patch series. The link is:
https://lore.kernel.org/all/[email protected]/

patch (1/9):
- Add es8323 compatible in everest,es8316.yaml instead of creating a new yaml file;

patch (2/9):
- Use regmap_config.reg_defaults instead of snd_soc_component_driver.{read/write};
- Use the more modern _CBC_CFC(SND_SOC_DAIFMT_BC_FC);
- Rewrite suspend/resume function with regmap;
- Drop i2c_check_functionality();
- Use named variables for the enums rather than putting them into an array;

patch (3/9):
- Add Reviewed-by tag from Krzysztof;

patch (4/9):
- Drop unused param to avoid lkp warnning;
- Drop some noisy log message(dev_info);
- Use normal conditional statements to improve legibility;
- Use provider/consumer instead of master/slave;
- Use the more modern _CBC_CFC(SND_SOC_DAIFMT_BC_FC);
- Drop uda1342_set_bias_level() for it does nothing;
- Drop uda1342_mixer_enum[] for it is unused;
- Point to controls/routes arrays from the component struct;
- REGCACHE_MAP instead of REGCACHE_RBTREE.

patch (5/9):
- Add of_node_put(args.np) after snd_soc_get_dai_name();
- Use matching label name, such as codec_put instead of free_codec;
- Rewrote the loongson_parse_cpu() and loongson_parse_codec() function interfaces to avoid dropping a reference from a pointer that is a random stack value

patch (6/9):
- Rename file name as loongson,ls2k1000-i2s.yaml;
- List and describe items for reg property;
- 'unevaluatedProperties: false' instead of 'additionalProperties:
false';

patch (7/9):
- Fix lkp warnning;
- Reorder Kconfig items, let
SND_SOC_LOONGSON_I2S_{PCI,PLATFORM} select SND_SOC_LOONGSON_CARD.

Link to v1:
https://lore.kernel.org/all/[email protected]/

Binbin Zhou (9):
ASoC: dt-bindings: Add Everest ES8323 Codec
ASoC: codecs: Add support for ES8323
ASoC: dt-bindings: Add NXP uda1342 Codec
ASoC: codecs: Add uda1342 codec driver
ASoC: loongson: Fix component check failed on FDT systems
ASoC: dt-bindings: Add Loongson I2S controller
ASoC: loongson: Add I2S controller driver as platform device
LoongArch: dts: Add I2S support to Loongson-2K1000
LoongArch: dts: Add I2S support to Loongson-2K2000

 .../bindings/sound/everest,es8316.yaml        |   4 +-
 .../bindings/sound/loongson,ls2k1000-i2s.yaml |  68 ++
 .../bindings/sound/nxp,uda1342.yaml           |  42 +
 arch/loongarch/boot/dts/loongson-2k1000.dtsi  |  17 +-
 arch/loongarch/boot/dts/loongson-2k2000.dtsi  |  22 +-
 sound/soc/codecs/Kconfig                      |  13 +
 sound/soc/codecs/Makefile                     |   4 +
 sound/soc/codecs/es8323.c                     | 792 ++++++++++++++++++
 sound/soc/codecs/es8323.h                     |  78 ++
 sound/soc/codecs/uda1342.c                    | 347 ++++++++
 sound/soc/codecs/uda1342.h                    |  78 ++
 sound/soc/loongson/Kconfig                    |  31 +-
 sound/soc/loongson/Makefile                   |   3 +
 sound/soc/loongson/loongson_card.c            |   1 +
 sound/soc/loongson/loongson_i2s_plat.c        | 185 ++++
 15 files changed, 1670 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/loongson,ls2k1000-i2s.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nxp,uda1342.yaml
 create mode 100644 sound/soc/codecs/es8323.c
 create mode 100644 sound/soc/codecs/es8323.h
 create mode 100644 sound/soc/codecs/uda1342.c
 create mode 100644 sound/soc/codecs/uda1342.h
 create mode 100644 sound/soc/loongson/loongson_i2s_plat.c

base-commit: d19f6bf5f17d77fb645654237130c94571c68a3d

Signature · 1 line
2.43.5
author maintainer
#1 lore raw

PATCH v3 1/9 ASoC: dt-bindings: Add Everest ES8323 Codec

Add DT bindings documentation for the Everest-semi ES8323 codec.

Everest-semi ES8323 codec is a low-power mono audio codec with I2S audio interface and I2C control.

---
 Documentation/devicetree/bindings/sound/everest,es8316.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/everest,es8316.yaml +3 -1
index 214f135b7777..e4b2eb5fae2f 100644
@@ -4,12 +4,13 @@
 $id: http://devicetree.org/schemas/sound/everest,es8316.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Everest ES8311 and ES8316 audio CODECs
+title: Everest ES8311, ES8316 and ES8323 audio CODECs
 
 maintainers:
   - Daniel Drake <[email protected]>
   - Katsuhiro Suzuki <[email protected]>
   - Matteo Martelli <[email protected]>
+  - Binbin Zhou <[email protected]>
 
 allOf:
   - $ref: dai-common.yaml#
@@ -19,6 +20,7 @@ properties:
     enum:
       - everest,es8311
       - everest,es8316
+      - everest,es8323
 
   reg:
     maxItems: 1
Signature · 1 line
2.43.5
author maintainer
#3 lore raw

PATCH v3 3/9 ASoC: dt-bindings: Add NXP uda1342 Codec

In reply to Binbin Zhou

Add NXP uda1342 CODEC binding with DT schema format using json-schema.

---
 .../bindings/sound/nxp,uda1342.yaml           | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nxp,uda1342.yaml
Documentation/devicetree/bindings/sound/nxp,uda1342.yaml new file +42 -0
new file mode 100644
index 000000000000..71c6a5a2f5bc
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nxp,uda1342.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP uda1342 audio CODECs
+
+maintainers:
+  - Binbin Zhou <[email protected]>
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    const: nxp,uda1342
+
+  reg:
+    maxItems: 1
+
+  '#sound-dai-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - '#sound-dai-cells'
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      codec@1a {
+        compatible = "nxp,uda1342";
+        reg = <0x1a>;
+        #sound-dai-cells = <0>;
+      };
+    };
Signature · 1 line
2.43.5
author maintainer
#2 lore raw

PATCH v3 2/9 ASoC: codecs: Add support for ES8323

In reply to Binbin Zhou

Add a codec driver for the Everest ES8323. It supports two separate audio outputs and two separate audio inputs.

---
 sound/soc/codecs/Kconfig  |   5 +
 sound/soc/codecs/Makefile |   2 +
 sound/soc/codecs/es8323.c | 792 ++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/es8323.h |  78 ++++
 4 files changed, 877 insertions(+)
 create mode 100644 sound/soc/codecs/es8323.c
 create mode 100644 sound/soc/codecs/es8323.h
sound/soc/codecs/Kconfig +5 -0
index 96c6dedd9808..6480f1bd43f4 100644
@@ -112,6 +112,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_DA9055
 	imply SND_SOC_DMIC
 	imply SND_SOC_ES8316
+	imply SND_SOC_ES8323
 	imply SND_SOC_ES8326
 	imply SND_SOC_ES8328_SPI
 	imply SND_SOC_ES8328_I2C
@@ -1144,6 +1145,10 @@ config SND_SOC_ES8316
 	tristate "Everest Semi ES8316 CODEC"
 	depends on I2C
 
+config SND_SOC_ES8323
+	tristate "Everest Semi ES8323 CODEC"
+	depends on I2C
+
 config SND_SOC_ES8326
 	tristate "Everest Semi ES8326 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index a2ccd868c5fd..029fa42ce5c0 100644
@@ -125,6 +125,7 @@ snd-soc-es7241-y := es7241.o
 snd-soc-es83xx-dsm-common-y := es83xx-dsm-common.o
 snd-soc-es8311-y := es8311.o
 snd-soc-es8316-y := es8316.o
+snd-soc-es8323-y := es8323.o
 snd-soc-es8326-y := es8326.o
 snd-soc-es8328-y := es8328.o
 snd-soc-es8328-i2c-y := es8328-i2c.o
@@ -537,6 +538,7 @@ obj-$(CONFIG_SND_SOC_ES7241)	+= snd-soc-es7241.o
 obj-$(CONFIG_SND_SOC_ES83XX_DSM_COMMON)    += snd-soc-es83xx-dsm-common.o
 obj-$(CONFIG_SND_SOC_ES8311)    += snd-soc-es8311.o
 obj-$(CONFIG_SND_SOC_ES8316)    += snd-soc-es8316.o
+obj-$(CONFIG_SND_SOC_ES8323)	+= snd-soc-es8323.o
 obj-$(CONFIG_SND_SOC_ES8326)    += snd-soc-es8326.o
 obj-$(CONFIG_SND_SOC_ES8328)	+= snd-soc-es8328.o
 obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
sound/soc/codecs/es8323.c new file +792 -0

792 lines not on this page · raw message

sound/soc/codecs/es8323.h new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.43.5
author maintainer
#4 lore raw

PATCH v3 4/9 ASoC: codecs: Add uda1342 codec driver

In reply to Binbin Zhou

The UDA1342 is an NXP audio codec, support 2x Stereo audio ADC (4x PGA mic inputs), stereo audio DAC, with basic audio processing.

---
 sound/soc/codecs/Kconfig   |   8 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/uda1342.c | 347 +++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/uda1342.h |  78 +++++++++
 4 files changed, 435 insertions(+)
 create mode 100644 sound/soc/codecs/uda1342.c
 create mode 100644 sound/soc/codecs/uda1342.h
sound/soc/codecs/Kconfig +8 -0
index 6480f1bd43f4..6a6125e94d2d 100644
@@ -283,6 +283,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_TWL4030
 	imply SND_SOC_TWL6040
 	imply SND_SOC_UDA1334
+	imply SND_SOC_UDA1342
 	imply SND_SOC_UDA1380
 	imply SND_SOC_WCD9335
 	imply SND_SOC_WCD934X
@@ -2131,6 +2132,13 @@ config SND_SOC_UDA1334
 	  and has basic features such as de-emphasis (at 44.1 kHz sampling
 	  rate) and mute.
 
+config SND_SOC_UDA1342
+	tristate "NXP UDA1342 CODEC"
+	depends on I2C
+	help
+	  The UDA1342 is an NXP audio codec, support 2x Stereo audio ADC (4x PGA
+	  mic inputs), stereo audio DAC, with basic audio processing.
+
 config SND_SOC_UDA1380
 	tristate
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 029fa42ce5c0..ac7d8b71b32b 100644
@@ -325,6 +325,7 @@ snd-soc-ts3a227e-y := ts3a227e.o
 snd-soc-twl4030-y := twl4030.o
 snd-soc-twl6040-y := twl6040.o
 snd-soc-uda1334-y := uda1334.o
+snd-soc-uda1342-y := uda1342.o
 snd-soc-uda1380-y := uda1380.o
 snd-soc-wcd-classh-y := wcd-clsh-v2.o
 snd-soc-wcd-mbhc-y := wcd-mbhc-v2.o
@@ -735,6 +736,7 @@ obj-$(CONFIG_SND_SOC_TS3A227E)	+= snd-soc-ts3a227e.o
 obj-$(CONFIG_SND_SOC_TWL4030)	+= snd-soc-twl4030.o
 obj-$(CONFIG_SND_SOC_TWL6040)	+= snd-soc-twl6040.o
 obj-$(CONFIG_SND_SOC_UDA1334)	+= snd-soc-uda1334.o
+obj-$(CONFIG_SND_SOC_UDA1342)	+= snd-soc-uda1342.o
 obj-$(CONFIG_SND_SOC_UDA1380)	+= snd-soc-uda1380.o
 obj-$(CONFIG_SND_SOC_WCD_CLASSH)	+= snd-soc-wcd-classh.o
 obj-$(CONFIG_SND_SOC_WCD_MBHC)	+= snd-soc-wcd-mbhc.o
sound/soc/codecs/uda1342.c new file +347 -0

347 lines not on this page · raw message

sound/soc/codecs/uda1342.h new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.43.5
author maintainer
#5 lore raw

PATCH v3 5/9 ASoC: loongson: Fix component check failed on FDT systems

In reply to Binbin Zhou

Add missing snd_soc_dai_link.platforms assignment to avoid soc_dai_link_sanity_check() failure.

Fixes d24028606e76 ("ASoC: loongson: Add Loongson ASoC Sound Card Support")
---
 sound/soc/loongson/loongson_card.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/loongson/loongson_card.c +1 -0
index 7379f24d385c..7910d5d9ac4f 100644
@@ -144,6 +144,7 @@ static int loongson_card_parse_of(struct loongson_card_data *data)
 			dev_err(dev, "getting cpu dlc error (%d)\n", ret);
 			goto err;
 		}
+		loongson_dai_links[i].platforms->of_node = loongson_dai_links[i].cpus->of_node;
 
 		ret = snd_soc_of_get_dlc(codec, NULL, loongson_dai_links[i].codecs, 0);
 		if (ret < 0) {
Signature · 1 line
2.43.5
author maintainer
#6 lore raw

PATCH v3 6/9 ASoC: dt-bindings: Add Loongson I2S controller

In reply to Binbin Zhou

Add Loongson I2S controller binding with DT schema format using json-schema.

---
 .../bindings/sound/loongson,ls2k1000-i2s.yaml | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/loongson,ls2k1000-i2s.yaml
Documentation/devicetree/bindings/sound/loongson,ls2k1000-i2s.yaml new file +68 -0
new file mode 100644
index 000000000000..da79510bb2d9
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/loongson,ls2k1000-i2s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson-2K1000 I2S controller
+
+maintainers:
+  - Binbin Zhou <[email protected]>
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    const: loongson,ls2k1000-i2s
+
+  reg:
+    items:
+      - description: Loongson I2S controller Registers.
+      - description: APB DMA config register for Loongson I2S controller.
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  dmas:
+    maxItems: 2
+
+  dma-names:
+    items:
+      - const: tx
+      - const: rx
+
+  '#sound-dai-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - dmas
+  - dma-names
+  - '#sound-dai-cells'
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2s@1fe2d000 {
+        compatible = "loongson,ls2k1000-i2s";
+        reg = <0x1fe2d000 0x14>,
+              <0x1fe00438 0x8>;
+        interrupt-parent = <&liointc0>;
+        interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk LOONGSON2_APB_CLK>;
+        dmas = <&apbdma2 0>, <&apbdma3 0>;
+        dma-names = "tx", "rx";
+        #sound-dai-cells = <0>;
+    };
+...
Signature · 1 line
2.43.5
author maintainer
#7 lore raw

PATCH v3 7/9 ASoC: loongson: Add I2S controller driver as platform device

In reply to Binbin Zhou

The Loongson I2S controller exists not only in PCI form (LS7A bridge chip), but also in platform device form (Loongson-2K1000 SoC).

This patch adds support for platform device I2S controller.

---
 sound/soc/loongson/Kconfig             |  31 +++--
 sound/soc/loongson/Makefile            |   3 +
 sound/soc/loongson/loongson_i2s_plat.c | 185 +++++++++++++++++++++++++
 3 files changed, 209 insertions(+), 10 deletions(-)
 create mode 100644 sound/soc/loongson/loongson_i2s_plat.c
sound/soc/loongson/Kconfig +21 -10
index b8d7e2bade24..e641ae4156d9 100644
@@ -1,11 +1,22 @@
 # SPDX-License-Identifier: GPL-2.0
 menu "SoC Audio for Loongson CPUs"
+
+config SND_SOC_LOONGSON_CARD
+	tristate "Loongson Sound Card Driver"
 	depends on LOONGARCH || COMPILE_TEST
+	select SND_SOC_LOONGSON_I2S_PCI if PCI
+	select SND_SOC_LOONGSON_I2S_PLATFORM if OF
+	help
+	  Say Y or M if you want to add support for SoC audio using
+	  loongson I2S controller.
+
+	  The driver add support for ALSA SoC Audio support using
+	  loongson I2S controller.
 
 config SND_SOC_LOONGSON_I2S_PCI
 	tristate "Loongson I2S-PCI Device Driver"
+	depends on LOONGARCH || COMPILE_TEST
 	select REGMAP_MMIO
-	depends on PCI
 	help
 	  Say Y or M if you want to add support for I2S driver for
 	  Loongson I2S controller.
@@ -13,15 +24,15 @@ config SND_SOC_LOONGSON_I2S_PCI
 	  The controller is found in loongson bridge chips or SoCs,
 	  and work as a PCI device.
 
-config SND_SOC_LOONGSON_CARD
-	tristate "Loongson Sound Card Driver"
-	select SND_SOC_LOONGSON_I2S_PCI
-	depends on PCI
+config SND_SOC_LOONGSON_I2S_PLATFORM
+	tristate "Loongson I2S-PLAT Device Driver"
+	depends on LOONGARCH || COMPILE_TEST
+	select REGMAP_MMIO
+	select SND_SOC_GENERIC_DMAENGINE_PCM
 	help
-	  Say Y or M if you want to add support for SoC audio using
-	  loongson I2S controller.
-
-	  The driver add support for ALSA SoC Audio support using
-	  loongson I2S controller.
+	  Say Y or M if you want to add support for I2S driver for
+	  Loongson I2S controller.
 
+	  The controller work as a platform device, we can found it in
+	  Loongson-2K1000 SoCs.
 endmenu
sound/soc/loongson/Makefile +3 -0
index 578030ad6563..f396259244a3 100644
@@ -3,6 +3,9 @@
 snd-soc-loongson-i2s-pci-y := loongson_i2s_pci.o loongson_i2s.o loongson_dma.o
 obj-$(CONFIG_SND_SOC_LOONGSON_I2S_PCI) += snd-soc-loongson-i2s-pci.o
 
+snd-soc-loongson-i2s-plat-y := loongson_i2s_plat.o loongson_i2s.o
+obj-$(CONFIG_SND_SOC_LOONGSON_I2S_PLATFORM) += snd-soc-loongson-i2s-plat.o
+
 #Machine Support
 snd-soc-loongson-card-y := loongson_card.o
 obj-$(CONFIG_SND_SOC_LOONGSON_CARD) += snd-soc-loongson-card.o
sound/soc/loongson/loongson_i2s_plat.c new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
2.43.5
author maintainer
#10 lore raw

PATCH v3 8/9 LoongArch: dts: Add I2S support to Loongson-2K1000

In reply to Binbin Zhou

The module is supported, adding it.

Not all Loongson-2K1000 boards have an i2s interface, here is an example of enabling it:

sound {
	compatible = "loongson,ls-audio-card";
	model = "Loongson-ASoC";
	mclk-fs = <512>;

	cpu {
		sound-dai = <&i2s>;
	};

	codec {
		sound-dai = <&uda1342>;
	};
};
&apbdma2 {
	status = "okay";
};
&apbdma3 {
	status = "okay";
};
&i2c3 {
	status = "okay";

	pinctrl-0 = <&i2c1_pins_default>;
	pinctrl-names = "default";

	#address-cells = <1>;
	#size-cells = <0>;

	uda1342: codec@1a {
		compatible = "nxp,uda1342";
		reg = <0x1a>;
		#sound-dai-cells = <0>;
	};
};
&i2s {
	status = "okay";

	pinctrl-0 = <&hda_pins_default>;
	pinctrl-names = "default";
};
---
 arch/loongarch/boot/dts/loongson-2k1000.dtsi | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
arch/loongarch/boot/dts/loongson-2k1000.dtsi +15 -2
index 92180140eb56..8dff2aa52417 100644
@@ -266,7 +266,7 @@ dma-controller@1fe00c10 {
 			status = "disabled";
 		};
 
-		dma-controller@1fe00c20 {
+		apbdma2: dma-controller@1fe00c20 {
 			compatible = "loongson,ls2k1000-apbdma";
 			reg = <0x0 0x1fe00c20 0x0 0x8>;
 			interrupt-parent = <&liointc1>;
@@ -276,7 +276,7 @@ dma-controller@1fe00c20 {
 			status = "disabled";
 		};
 
-		dma-controller@1fe00c30 {
+		apbdma3: dma-controller@1fe00c30 {
 			compatible = "loongson,ls2k1000-apbdma";
 			reg = <0x0 0x1fe00c30 0x0 0x8>;
 			interrupt-parent = <&liointc1>;
@@ -352,6 +352,19 @@ rtc0: rtc@1fe27800 {
 			status = "disabled";
 		};
 
+		i2s: i2s@1fe2d000 {
+			compatible = "loongson,ls2k1000-i2s";
+			reg = <0 0x1fe2d000 0 0x14>,
+			      <0 0x1fe00438 0 0x8>;
+			interrupt-parent = <&liointc0>;
+			interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk LOONGSON2_APB_CLK>;
+			dmas = <&apbdma2 0>, <&apbdma3 0>;
+			dma-names = "tx", "rx";
+			#sound-dai-cells = <0>;
+			status = "disabled";
+		};
+
 		spi0: spi@1fff0220 {
 			compatible = "loongson,ls2k1000-spi";
 			reg = <0x0 0x1fff0220 0x0 0x10>;
Signature · 1 line
2.43.5
author maintainer
#11 lore raw

PATCH v3 9/9 LoongArch: dts: Add I2S support to Loongson-2K2000

In reply to Binbin Zhou

The module is supported, adding it.

Not all Loongson-2K1000 boards have an i2s interface, here is an example of enabling it:

sound {
	compatible = "loongson,ls-audio-card";
	model = "Loongson-ASoC";
	mclk-fs = <512>;

	cpu {
		sound-dai = <&i2s>;
	};

	codec {
		sound-dai = <&es8323>;
	};
};
&i2c1 {
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;

	es8323:es8323@10 {
		compatible = "everest,es8323";
		reg = <0x10>;
		#sound-dai-cells = <0>;
	};
};
&i2s {
	status = "okay";

	clock-frequency = <175000000>;
	#sound-dai-cells = <0>;
};
---
 arch/loongarch/boot/dts/loongson-2k2000.dtsi | 22 ++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
arch/loongarch/boot/dts/loongson-2k2000.dtsi +20 -2
index 0953c5707825..b4ff55a33e90 100644
@@ -173,6 +173,22 @@ rtc0: rtc@100d0100 {
 			status = "disabled";
 		};
 
+		i2c@1fe00120 {
+			compatible = "loongson,ls2k-i2c";
+			reg = <0x0 0x1fe00120 0x0 0x8>;
+			interrupt-parent = <&liointc>;
+			interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		i2c@1fe00130 {
+			compatible = "loongson,ls2k-i2c";
+			reg = <0x0 0x1fe00130 0x0 0x8>;
+			interrupt-parent = <&liointc>;
+			interrupts = <9 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
 		uart0: serial@1fe001e0 {
 			compatible = "ns16550a";
 			reg = <0x0 0x1fe001e0 0x0 0x10>;
@@ -243,9 +259,11 @@ display@6,1 {
 				status = "disabled";
 			};
 
-			hda@7,0 {
+			i2s@7,0 {
 				reg = <0x3800 0x0 0x0 0x0 0x0>;
-				interrupts = <58 IRQ_TYPE_LEVEL_HIGH>;
+				interrupts = <78 IRQ_TYPE_LEVEL_HIGH>,
+					     <79 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "tx", "rx";
 				interrupt-parent = <&pic>;
 				status = "disabled";
 			};
Signature · 1 line
2.43.5
#8 lore raw

Re: [PATCH v3 7/9] ASoC: loongson: Add I2S controller driver as platform device

In reply to Binbin Zhou
kernel test robot noticed the following build errors:

Hi Binbin,

kernel test robot noticed the following build errors:

[auto build test ERROR on d19f6bf5f17d77fb645654237130c94571c68a3d]

url:    https://github.com/intel-lab-lkp/linux/commits/Binbin-Zhou/ASoC-dt-bindings-Add-Everest-ES8323-Codec/20241009-155516
base:   d19f6bf5f17d77fb645654237130c94571c68a3d
patch link:    https://lore.kernel.org/r/36c143358c7f48bc2e73c30e1d2009b2f2fc6498.1728459624.git.zhoubinbin%40loongson.cn
patch subject: [PATCH v3 7/9] ASoC: loongson: Add I2S controller driver as platform device
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20241010/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241010/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

>> sound/soc/loongson/loongson_i2s_pci.c:157:1: warning: data definition has no type or storage class
     157 | module_pci_driver(loongson_i2s_driver);
         | ^~~~~~~~~~~~~~~~~
>> sound/soc/loongson/loongson_i2s_pci.c:157:1: error: type defaults to 'int' in declaration of 'module_pci_driver' [-Wimplicit-int]
>> sound/soc/loongson/loongson_i2s_pci.c:157:1: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
>> sound/soc/loongson/loongson_i2s_pci.c:149:26: warning: 'loongson_i2s_driver' defined but not used [-Wunused-variable]
     149 | static struct pci_driver loongson_i2s_driver = {
         |                          ^~~~~~~~~~~~~~~~~~~

vim +/loongson_i2s_driver +149 sound/soc/loongson/loongson_i2s_pci.c

d84881e06836dc Yingkun Meng 2023-06-15 148

d84881e06836dc Yingkun Meng 2023-06-15 @149  static struct pci_driver loongson_i2s_driver = {
d84881e06836dc Yingkun Meng 2023-06-15  150  	.name = "loongson-i2s-pci",
d84881e06836dc Yingkun Meng 2023-06-15  151  	.id_table = loongson_i2s_ids,
d84881e06836dc Yingkun Meng 2023-06-15  152  	.probe = loongson_i2s_pci_probe,
d84881e06836dc Yingkun Meng 2023-06-15  153  	.driver = {
d84881e06836dc Yingkun Meng 2023-06-15  154  		.pm = pm_sleep_ptr(&loongson_i2s_pm),
d84881e06836dc Yingkun Meng 2023-06-15  155  	},
d84881e06836dc Yingkun Meng 2023-06-15  156  };
d84881e06836dc Yingkun Meng 2023-06-15 @157  module_pci_driver(loongson_i2s_driver);

d84881e06836dc Yingkun Meng 2023-06-15 158

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw

Re: [PATCH v3 7/9] ASoC: loongson: Add I2S controller driver as platform device

In reply to Binbin Zhou
kernel test robot noticed the following build errors:

Hi Binbin,

kernel test robot noticed the following build errors:

[auto build test ERROR on d19f6bf5f17d77fb645654237130c94571c68a3d]

url:    https://github.com/intel-lab-lkp/linux/commits/Binbin-Zhou/ASoC-dt-bindings-Add-Everest-ES8323-Codec/20241009-155516
base:   d19f6bf5f17d77fb645654237130c94571c68a3d
patch link:    https://lore.kernel.org/r/36c143358c7f48bc2e73c30e1d2009b2f2fc6498.1728459624.git.zhoubinbin%40loongson.cn
patch subject: [PATCH v3 7/9] ASoC: loongson: Add I2S controller driver as platform device
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241010/[email protected]/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 70e0a7e7e6a8541bcc46908c592eed561850e416)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241010/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from sound/soc/loongson/loongson_i2s_pci.c:12:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]

     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from sound/soc/loongson/loongson_i2s_pci.c:12:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from sound/soc/loongson/loongson_i2s_pci.c:12:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from sound/soc/loongson/loongson_i2s_pci.c:12:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> sound/soc/loongson/loongson_i2s_pci.c:157:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
     157 | module_pci_driver(loongson_i2s_driver);
         | ^
         | int
>> sound/soc/loongson/loongson_i2s_pci.c:157:19: error: a parameter list without types is only allowed in a function definition
     157 | module_pci_driver(loongson_i2s_driver);
         |                   ^

7 warnings and 2 errors generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]

vim +/int +157 sound/soc/loongson/loongson_i2s_pci.c

d84881e06836dc Yingkun Meng 2023-06-15  148  
d84881e06836dc Yingkun Meng 2023-06-15  149  static struct pci_driver loongson_i2s_driver = {
d84881e06836dc Yingkun Meng 2023-06-15  150  	.name = "loongson-i2s-pci",
d84881e06836dc Yingkun Meng 2023-06-15  151  	.id_table = loongson_i2s_ids,
d84881e06836dc Yingkun Meng 2023-06-15  152  	.probe = loongson_i2s_pci_probe,
d84881e06836dc Yingkun Meng 2023-06-15  153  	.driver = {
d84881e06836dc Yingkun Meng 2023-06-15  154  		.pm = pm_sleep_ptr(&loongson_i2s_pm),
d84881e06836dc Yingkun Meng 2023-06-15  155  	},
d84881e06836dc Yingkun Meng 2023-06-15  156  };

d84881e06836dc Yingkun Meng 2023-06-15 @157 module_pci_driver(loongson_i2s_driver); d84881e06836dc Yingkun Meng 2023-06-15 158

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#12 lore raw

Re: (subset) [PATCH v3 0/9] ASoC: Some issues about loongson i2s

In reply to Binbin Zhou
Quoted 10 lines · Binbin Zhou

This patch set is mainly about Loongson i2s related issues.

Please allow me to briefly explain this patch set:
Patch 1-2: Add ES8323 codec required on Loongson-2K2000 Patch 3-4: Add uda1342 codec required on Loongson-2K1000 Patch 5: Fix the problem of unable to detect codec under FDT system. Patch 6-7: Add Loongson i2s platform device support
Patch 8-9: Related DTS support.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/9] ASoC: dt-bindings: Add Everest ES8323 Codec

      commit: 5bf2bea8a8b3d0255953868c7bf652235a17a65d
[2/9] ASoC: codecs: Add support for ES8323
      commit: b97391a604b9e259c6a983fc1b715d205d9da505
[3/9] ASoC: dt-bindings: Add NXP uda1342 Codec
      commit: de567431596a8163a9441407fdab315f12bc2769
[4/9] ASoC: codecs: Add uda1342 codec driver
      commit: de0fb25e37aae7aae133d6c3d0b0e1e31a79878d
[5/9] ASoC: loongson: Fix component check failed on FDT systems
      (no commit info)
[6/9] ASoC: dt-bindings: Add Loongson I2S controller
      commit: d4c2e9e33a0c903cc3a00114d6c02aa2cf403d33
[7/9] ASoC: loongson: Add I2S controller driver as platform device
      commit: ba4c5fad598c07492844e514add3ccda467063b2

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

#13 lore raw

Re: (subset) [PATCH v3 0/9] ASoC: Some issues about loongson i2s

Hi Mark:

Quoted 27 lines · Mark Brown
Quoted 10 lines · Binbin Zhou

This patch set is mainly about Loongson i2s related issues.

Please allow me to briefly explain this patch set:
Patch 1-2: Add ES8323 codec required on Loongson-2K2000 Patch 3-4: Add uda1342 codec required on Loongson-2K1000 Patch 5: Fix the problem of unable to detect codec under FDT system. Patch 6-7: Add Loongson i2s platform device support
Patch 8-9: Related DTS support.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/9] ASoC: dt-bindings: Add Everest ES8323 Codec

      commit: 5bf2bea8a8b3d0255953868c7bf652235a17a65d
[2/9] ASoC: codecs: Add support for ES8323
      commit: b97391a604b9e259c6a983fc1b715d205d9da505
[3/9] ASoC: dt-bindings: Add NXP uda1342 Codec
      commit: de567431596a8163a9441407fdab315f12bc2769
[4/9] ASoC: codecs: Add uda1342 codec driver
      commit: de0fb25e37aae7aae133d6c3d0b0e1e31a79878d
Quoted 2 lines

[5/9] ASoC: loongson: Fix component check failed on FDT systems
(no commit info)

Thanks for applying this patchset.

But I don't seem to see the 5th patch in the for-next branch, what other questions do you have about that patch?
On FDT systems we need this patch, otherwise the component check will fail.

Thanks.
Binbin

Quoted 24 lines

[6/9] ASoC: dt-bindings: Add Loongson I2S controller

      commit: d4c2e9e33a0c903cc3a00114d6c02aa2cf403d33
[7/9] ASoC: loongson: Add I2S controller driver as platform device
      commit: ba4c5fad598c07492844e514add3ccda467063b2

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

maintainer
#14 lore raw

Re: (subset) [PATCH v3 0/9] ASoC: Some issues about loongson i2s

Quoted 10 lines · Binbin Zhou
Quoted 2 lines · Mark Brown

[5/9] ASoC: loongson: Fix component check failed on FDT systems
(no commit info)

Thanks for applying this patchset.

But I don't seem to see the 5th patch in the for-next branch, what other questions do you have about that patch?
On FDT systems we need this patch, otherwise the component check will fail.

That's a bugfix so is going as such.