Skip to content

Commit

Permalink
Add support for merus-amp soundcard and ma120x0p codec
Browse files Browse the repository at this point in the history
correct checkpatch warnings and errors

Signed-off-by: AMuszkat <ariel.muszkat@gmail.com>
  • Loading branch information
AMuszkat authored and pelwell committed Mar 6, 2020
1 parent ac0d226 commit 6a5bfd7
Show file tree
Hide file tree
Showing 7 changed files with 1,485 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
mcp3202.dtbo \
mcp342x.dtbo \
media-center.dtbo \
merus-amp.dtbo \
midi-uart0.dtbo \
midi-uart1.dtbo \
miniuart-bt.dtbo \
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,12 @@ Params: speed Display SPI bus speed
(default "off")


Name: merus-amp
Info: Configures the merus-amp audio card
Load: dtoverlay=merus-amp
Params: <None>


Name: midi-uart0
Info: Configures UART0 (ttyAMA0) so that a requested 38.4kbaud actually gets
31.25kbaud, the frequency required for MIDI
Expand Down
60 changes: 60 additions & 0 deletions arch/arm/boot/dts/overlays/merus-amp-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: GPL-2.0-only
// Definitions for Infineon Merus-Amp
/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/bcm2835.h>
#include <dt-bindings/gpio/gpio.h>


/ {
compatible = "brcm,bcm2835";

fragment@0 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};

fragment@1 {
target = <&gpio>;
__overlay__ {
merus_amp_pins: merus_amp_pins {
brcm,pins = <23>;
brcm,function = <0>; /* in */
brcm,pull = <2>; /* up */
};
};
};

fragment@2 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

merus_amp: ma120x0p@20 {
#sound-dai-cells = <0>;
compatible = "ma,ma120x0p";
reg = <0x20>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&merus_amp_pins>;
enable_gp-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
mute_gp-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
booster_gp-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
error_gp-gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
};
};
};

fragment@3 {
target = <&sound>;
__overlay__ {
compatible = "merus,merus-amp";
i2s-controller = <&i2s>;
status = "okay";
};
};
};
24 changes: 24 additions & 0 deletions sound/soc/bcm/rpi-simple-soundcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* adau1977-adc.c
* by Andrey Grodzovsky <andrey2805@gmail.com>
*
* merus-amp.c
* by Ariel Muszkat <ariel.muszkat@gmail.com>
* Jorgen Kragh Jakobsen <jorgen.kraghjakobsen@infineon.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
Expand Down Expand Up @@ -205,6 +209,24 @@ static struct snd_rpi_simple_drvdata drvdata_rpi_dac = {
.fixed_bclk_ratio = 64,
};

static struct snd_soc_dai_link snd_merus_amp_dai[] = {
{
.name = "MerusAmp",
.stream_name = "Merus Audio Amp",
.codec_dai_name = "ma120x0p-amp",
.codec_name = "ma120x0p.1-0020",
.dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
},
};

static struct snd_rpi_simple_drvdata drvdata_merus_amp = {
.card_name = "snd_rpi_merus_amp",
.dai = snd_merus_amp_dai,
.fixed_bclk_ratio = 64,
};

static const struct of_device_id snd_rpi_simple_of_match[] = {
{ .compatible = "adi,adau1977-adc",
.data = (void *) &drvdata_adau1977 },
Expand All @@ -217,6 +239,8 @@ static const struct of_device_id snd_rpi_simple_of_match[] = {
{ .compatible = "hifiberry,hifiberry-dac",
.data = (void *) &drvdata_hifiberry_dac },
{ .compatible = "rpi,rpi-dac", &drvdata_rpi_dac},
{ .compatible = "merus,merus-amp",
.data = (void *) &drvdata_merus_amp },
{},
};

Expand Down
8 changes: 8 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_JZ4740_CODEC
select SND_SOC_LM4857 if I2C
select SND_SOC_LM49453 if I2C
select SND_SOC_MA120X0P if I2C
select SND_SOC_MAX98088 if I2C
select SND_SOC_MAX98090 if I2C
select SND_SOC_MAX98095 if I2C
Expand Down Expand Up @@ -631,6 +632,13 @@ config SND_SOC_ISABELLE
config SND_SOC_LM49453
tristate

config SND_SOC_MA120X0P
tristate "Infineon Merus(TM) MA120X0P Multilevel Class-D Audio amplifiers"
depends on I2C
help
Enable support for Infineon MA120X0P Multilevel Class-D audio power
amplifiers.

config SND_SOC_MAX98088
tristate

Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ snd-soc-jz4740-codec-objs := jz4740.o
snd-soc-l3-objs := l3.o
snd-soc-lm4857-objs := lm4857.o
snd-soc-lm49453-objs := lm49453.o
snd-soc-ma120x0p-objs := ma120x0p.o
snd-soc-max9759-objs := max9759.o
snd-soc-max9768-objs := max9768.o
snd-soc-max98088-objs := max98088.o
Expand Down Expand Up @@ -349,6 +350,7 @@ obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o
obj-$(CONFIG_SND_SOC_LM49453) += snd-soc-lm49453.o
obj-$(CONFIG_SND_SOC_MA120X0P) += snd-soc-ma120x0p.o
obj-$(CONFIG_SND_SOC_MAX9759) += snd-soc-max9759.o
obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o
obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
Expand Down
Loading

0 comments on commit 6a5bfd7

Please sign in to comment.