Maxim MAX98357A I2S DAC overlay (#2935)
authorwavelet2 <20504977+wavelet2@users.noreply.github.com>
Mon, 15 Apr 2019 09:00:20 +0000 (10:00 +0100)
committerpopcornmix <popcornmix@gmail.com>
Mon, 13 May 2019 23:08:28 +0000 (00:08 +0100)
Add overlay for Maxim MAX98357A I2S DAC.

Signed-off-by: Richard Steedman <richard.steedman@gmail.com>
arch/arm/boot/dts/overlays/Makefile
arch/arm/boot/dts/overlays/README
arch/arm/boot/dts/overlays/max98357a-overlay.dts [new file with mode: 0644]

index c5b6154..36c588b 100644 (file)
@@ -75,6 +75,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
        justboom-dac.dtbo \
        justboom-digi.dtbo \
        ltc294x.dtbo \
+       max98357a.dtbo \
        mbed-dac.dtbo \
        mcp23017.dtbo \
        mcp23s17.dtbo \
index 2e5094b..8962dd0 100644 (file)
@@ -1276,6 +1276,15 @@ Params: ltc2941                 Select the ltc2941 device
                                 See the datasheet for more information.
 
 
+Name:   max98357a
+Info:   Configures the Maxim MAX98357A I2S DAC
+Load:   dtoverlay=max98357a,<param>=<val>
+Params: no-sdmode               Driver does not manage the state of the DAC's
+                                SD_MODE pin (i.e. chip is always on).
+        sdmode-pin              integer, GPIO pin connected to the SD_MODE input
+                                of the DAC (default GPIO4 if parameter omitted).
+
+
 Name:   mbed-dac
 Info:   Configures the mbed AudioCODEC (TLV320AIC23B)
 Load:   dtoverlay=mbed-dac
diff --git a/arch/arm/boot/dts/overlays/max98357a-overlay.dts b/arch/arm/boot/dts/overlays/max98357a-overlay.dts
new file mode 100644 (file)
index 0000000..ed3960f
--- /dev/null
@@ -0,0 +1,84 @@
+// Overlay for Maxim MAX98357A audio DAC
+
+// dtparams:
+//     no-sdmode  - SD_MODE pin not managed by driver.
+//     sdmode-pin - Specify GPIO pin to which SD_MODE is connected (default 4).
+
+/dts-v1/;
+/plugin/;
+
+/ {
+       compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
+
+       /* Enable I2S */
+       fragment@0 {
+               target = <&i2s>;
+               __overlay__ {
+                       status = "okay";
+               };
+       };
+
+       /* DAC whose SD_MODE pin is managed by driver (via GPIO pin) */
+       fragment@1 {
+               target-path = "/";
+               __overlay__ {
+                       max98357a_dac: max98357a {
+                               compatible = "maxim,max98357a";
+                               #sound-dai-cells = <0>;
+                               sdmode-gpios = <&gpio 4 0>;   /* 2nd word overwritten by sdmode-pin parameter */
+                               status = "okay";
+                       };
+               };
+       };
+
+       /* DAC whose SD_MODE pin is not managed by driver */
+       fragment@2 {
+               target-path = "/";
+               __dormant__ {
+                       max98357a_nsd: max98357a {
+                               compatible = "maxim,max98357a";
+                               #sound-dai-cells = <0>;
+                               status = "okay";
+                       };
+               };
+       };
+
+       /* Soundcard connecting I2S to DAC with SD_MODE */
+       fragment@3 {
+               target = <&sound>;
+               __overlay__ {
+                       compatible = "simple-audio-card";
+                       simple-audio-card,format = "i2s";
+                       simple-audio-card,name = "MAX98357A";
+                       status = "okay";
+                       simple-audio-card,cpu {
+                               sound-dai = <&i2s>;
+                       };
+                       simple-audio-card,codec {
+                               sound-dai = <&max98357a_dac>;
+                       };
+               };
+       };
+
+       /* Soundcard connecting I2S to DAC without SD_MODE */
+       fragment@4 {
+               target = <&sound>;
+               __dormant__ {
+                       compatible = "simple-audio-card";
+                       simple-audio-card,format = "i2s";
+                       simple-audio-card,name = "MAX98357A";
+                       status = "okay";
+                       simple-audio-card,cpu {
+                               sound-dai = <&i2s>;
+                       };
+                       simple-audio-card,codec {
+                               sound-dai = <&max98357a_nsd>;
+                       };
+               };
+       };
+
+       __overrides__ {
+               no-sdmode  = <0>,"-1+2-3+4";
+               sdmode-pin = <&max98357a_dac>,"sdmode-gpios:4";
+       };
+};