Unverified Commit 5865e8c4 authored by Mark Brown's avatar Mark Brown
Browse files

Add support for Loongson-1 AC97

Merge series from Keguang Zhang <keguang.zhang@gmail.com>:

Add the driver and dt-binding document for Loongson-1 AC97.
Add the dt-binding document for Realtek ALC203 Codec.
Add DT support for the AC97 generic codec driver.
parents fabb0a10 436a3cc8
Loading
Loading
Loading
Loading
+68 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/loongson,ls1b-ac97.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Loongson-1 AC97 Controller

maintainers:
  - Keguang Zhang <keguang.zhang@gmail.com>

description:
  The Loongson-1 AC97 controller supports 2-channel stereo output and input.
  It is paired with the DMA engine to handle playback and capture functions.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    oneOf:
      - const: loongson,ls1b-ac97
      - items:
          - enum:
              - loongson,ls1a-ac97
              - loongson,ls1c-ac97
          - const: loongson,ls1b-ac97

  reg:
    maxItems: 3

  reg-names:
    items:
      - const: ac97
      - const: audio-tx
      - const: audio-rx

  dmas:
    maxItems: 2

  dma-names:
    items:
      - const: tx
      - const: rx

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - reg
  - reg-names
  - dmas
  - dma-names
  - '#sound-dai-cells'

unevaluatedProperties: false

examples:
  - |
    audio-controller@1fe74000 {
        compatible = "loongson,ls1b-ac97";
        reg = <0x1fe74000 0x60>, <0x1fe72420 0x4>, <0x1fe74c4c 0x4>;
        reg-names = "ac97", "audio-tx", "audio-rx";
        dmas = <&dma 1>, <&dma 2>;
        dma-names = "tx", "rx";
        #sound-dai-cells = <0>;
    };
+36 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/realtek,alc203.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Realtek ALC203 AC97 Audio Codec

maintainers:
  - Keguang Zhang <keguang.zhang@gmail.com>

description:
  ALC203 is a full duplex AC97 2.3 compatible stereo audio codec.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    const: realtek,alc203

  '#sound-dai-cells':
    const: 0

required:
  - compatible
  - '#sound-dai-cells'

unevaluatedProperties: false

examples:
  - |
    audio-codec {
        compatible = "realtek,alc203";
        #sound-dai-cells = <0>;
    };
+1 −0
Original line number Diff line number Diff line
@@ -16223,6 +16223,7 @@ F: arch/mips/include/asm/mach-loongson32/
F:	arch/mips/loongson32/
F:	drivers/*/*loongson1*
F:	drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
F:	sound/soc/loongson/loongson1_ac97.c
MIPS/LOONGSON2EF ARCHITECTURE
M:	Jiaxun Yang <jiaxun.yang@flygoat.com>
+10 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
@@ -127,9 +128,18 @@ static int ac97_probe(struct platform_device *pdev)
			&soc_component_dev_ac97, &ac97_dai, 1);
}

#ifdef CONFIG_OF
static const struct of_device_id ac97_codec_of_match[] = {
	{ .compatible = "realtek,alc203", },
	{ }
};
MODULE_DEVICE_TABLE(of, ac97_codec_of_match);
#endif

static struct platform_driver ac97_codec_driver = {
	.driver = {
		.name = "ac97-codec",
		.of_match_table = of_match_ptr(ac97_codec_of_match),
	},

	.probe = ac97_probe,
+10 −0
Original line number Diff line number Diff line
@@ -37,3 +37,13 @@ config SND_SOC_LOONGSON_I2S_PLATFORM
	  The controller work as a platform device, we can found it in
	  Loongson-2K1000 SoCs.
endmenu

config SND_LOONGSON1_AC97
	tristate "Loongson1 AC97 Support"
	depends on LOONGSON1_APB_DMA
	select SND_SOC_AC97_CODEC
	select SND_SOC_GENERIC_DMAENGINE_PCM
	select REGMAP_MMIO
	help
	  Say Y or M if you want to add support for codecs attached to
	  the Loongson1 AC97 controller.
Loading