From d7f38adfe48cb47419246cbe2f3713f992303927 Mon Sep 17 00:00:00 2001 From: R F William Hollender Date: Thu, 15 Feb 2018 17:07:50 -0600 Subject: [PATCH 1/6] Initial commit of SAB using the simple-audio-card driver. Need to test yet --- .../dts/overlays/superaudioboard-overlay.dts | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 arch/arm/boot/dts/overlays/superaudioboard-overlay.dts diff --git a/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts b/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts new file mode 100755 index 00000000000000..fb4e69c31e284f --- /dev/null +++ b/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts @@ -0,0 +1,84 @@ +// Definitions for SuperAudioBoard +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sound>; + __overlay__ { + compatible = "simple-audio-card"; + i2s-controller = <&i2s>; + status = "okay"; + + simple-audio-card,name = "SuperAudioBoard"; + + simple-audio-card,widgets = + "Line", "Line In", + "Line", "Line Out"; + + simple-audio-card,routing = + "Line Out","AOUTA+", + "Line Out","AOUTA-", + "Line Out","AOUTB+", + "Line Out","AOUTB-", + "Line In","AINA", + "Line In","AINB"; + + simple-audio-card,format = "i2s"; + + simple-audio-card,mclk-fs = <64>; + + simple-audio-card,cpu { + sound-dai = <&i2s>; + } + + sound_master: simple-audio-card,codec { + sound-dai = <&cs4271>; + system-clock-frequency = <24576000>; + } + }; + }; + + fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&gpio>; + __overlay__ { + sab_pins: sab_pins { + brcm,pins = <26>; /* Pin 26 */ + brcm,function = <1>; /* Output */ + }; + }; + }; + + fragment@3 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + cs4271: cs4271@10 { + #sound-dai-cells = <0>; + compatible = "cirrus,cs4271"; + reg = <0x10>; + status = "okay"; + reset-gpio = <&gpio 26 0>; /* Pin 26, active high */ + + pinctrl-names = "default"; + pinctrl-0 = <&sab_pins>; + }; + }; + }; + __overrides__ { + gpiopin = <&cs4271>,"reset-gpio:4", + <&sab_pins>,"brcm,pins:0"; + }; +}; From 454f35c9d0af765921de93cc058d150498ca485a Mon Sep 17 00:00:00 2001 From: RF William Hollender Date: Fri, 16 Feb 2018 13:52:58 -0600 Subject: [PATCH 2/6] SuperAudioBoard driver based on simple-audio-card --- arch/arm/boot/dts/overlays/Makefile | 1 + arch/arm/boot/dts/overlays/README | 6 ++++ .../dts/overlays/superaudioboard-overlay.dts | 33 +++++++------------ arch/arm/configs/bcm2709_defconfig | 1 + arch/arm/configs/bcmrpi_defconfig | 1 + arch/arm64/configs/bcmrpi3_defconfig | 1 + 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile index 3c8222020562d9..a4c5b740bf74cd 100644 --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -118,6 +118,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ spi2-1cs.dtbo \ spi2-2cs.dtbo \ spi2-3cs.dtbo \ + superaudioboard.dtbo \ tinylcd35.dtbo \ uart0.dtbo \ uart1.dtbo \ diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README index 88f67db61e9e3c..e07ea425167c8b 100644 --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -1658,6 +1658,12 @@ Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). is 'okay' or enabled). +Name: superaudioboard +Info: Configures the SuperAudioBoard sound card +Load: dtoverlay=superaudioboard,= +Params: gpiopin GPIO pin for codec reset + + Name: tinylcd35 Info: 3.5" Color TFT Display by www.tinylcd.com Options: Touch, RTC, keypad diff --git a/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts b/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts index fb4e69c31e284f..41a99bab635313 100755 --- a/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts +++ b/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts @@ -23,21 +23,24 @@ "Line Out","AOUTA-", "Line Out","AOUTB+", "Line Out","AOUTB-", - "Line In","AINA", - "Line In","AINB"; + "AINA","Line In", + "AINB","Line In"; simple-audio-card,format = "i2s"; - simple-audio-card,mclk-fs = <64>; + simple-audio-card,bitclock-master = <&sound_master>; + simple-audio-card,frame-master = <&sound_master>; simple-audio-card,cpu { sound-dai = <&i2s>; - } + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + }; sound_master: simple-audio-card,codec { sound-dai = <&cs4271>; system-clock-frequency = <24576000>; - } + }; }; }; @@ -48,17 +51,7 @@ }; }; - fragment@2 { - target = <&gpio>; - __overlay__ { - sab_pins: sab_pins { - brcm,pins = <26>; /* Pin 26 */ - brcm,function = <1>; /* Output */ - }; - }; - }; - - fragment@3 { + fragment@2 { target = <&i2c1>; __overlay__ { #address-cells = <1>; @@ -70,15 +63,11 @@ compatible = "cirrus,cs4271"; reg = <0x10>; status = "okay"; - reset-gpio = <&gpio 26 0>; /* Pin 26, active high */ - - pinctrl-names = "default"; - pinctrl-0 = <&sab_pins>; + reset-gpio = <&gpio 26 0>; /* Pin 26, active high */ }; }; }; __overrides__ { - gpiopin = <&cs4271>,"reset-gpio:4", - <&sab_pins>,"brcm,pins:0"; + gpiopin = <&cs4271>,"reset-gpio:4"; }; }; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig index 766e1d12436d65..2e6c14f98b1b98 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -899,6 +899,7 @@ CONFIG_SND_SOC_SPDIF=m CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m CONFIG_SND_AUDIO_GRAPH_CARD=m +CONFIG_SND_SOC_CS4271_I2C=m CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HIDRAW=y CONFIG_UHID=m diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig index 4e92a1107513b6..7b54a60211671f 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -892,6 +892,7 @@ CONFIG_SND_SOC_SPDIF=m CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m CONFIG_SND_AUDIO_GRAPH_CARD=m +CONFIG_SND_SOC_CS4271_I2C=m CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HIDRAW=y CONFIG_UHID=m diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig index 003209bf2362c2..ed28d685220eb7 100644 --- a/arch/arm64/configs/bcmrpi3_defconfig +++ b/arch/arm64/configs/bcmrpi3_defconfig @@ -874,6 +874,7 @@ CONFIG_SND_SOC_ADAU1701=m CONFIG_SND_SOC_AK4554=m CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m +CONFIG_SND_SOC_CS4271_I2C=m CONFIG_SOUND_PRIME=m CONFIG_HIDRAW=y CONFIG_UHID=m From c54e1f6e9b464cb9fb59d9887bb033aa35d33aa8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 18 Feb 2018 20:31:14 +0000 Subject: [PATCH 3/6] bcm2709_defconfig - correct order --- arch/arm/configs/bcm2709_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig index 2e6c14f98b1b98..29915443fce612 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -895,11 +895,11 @@ CONFIG_SND_PISOUND=m CONFIG_SND_SOC_ADAU1701=m CONFIG_SND_SOC_ADAU7002=m CONFIG_SND_SOC_AK4554=m +CONFIG_SND_SOC_CS4271_I2C=m CONFIG_SND_SOC_SPDIF=m CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m CONFIG_SND_AUDIO_GRAPH_CARD=m -CONFIG_SND_SOC_CS4271_I2C=m CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HIDRAW=y CONFIG_UHID=m From 75472bcfe08ecf90c882f1596c02c474961422ad Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 18 Feb 2018 20:32:29 +0000 Subject: [PATCH 4/6] bcmrpi_defconfig - correct order --- arch/arm/configs/bcmrpi_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig index 7b54a60211671f..7af3dd3cc385ed 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -888,11 +888,11 @@ CONFIG_SND_PISOUND=m CONFIG_SND_SOC_ADAU1701=m CONFIG_SND_SOC_ADAU7002=m CONFIG_SND_SOC_AK4554=m +CONFIG_SND_SOC_CS4271_I2C=m CONFIG_SND_SOC_SPDIF=m CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m CONFIG_SND_AUDIO_GRAPH_CARD=m -CONFIG_SND_SOC_CS4271_I2C=m CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HIDRAW=y CONFIG_UHID=m From ad42d2079b9092564b22e30f80e630b665451ce1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 18 Feb 2018 20:36:32 +0000 Subject: [PATCH 5/6] Use TABs in the overlay --- .../dts/overlays/superaudioboard-overlay.dts | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts b/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts index 41a99bab635313..e625faeed7fbca 100755 --- a/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts +++ b/arch/arm/boot/dts/overlays/superaudioboard-overlay.dts @@ -12,35 +12,35 @@ i2s-controller = <&i2s>; status = "okay"; - simple-audio-card,name = "SuperAudioBoard"; + simple-audio-card,name = "SuperAudioBoard"; - simple-audio-card,widgets = - "Line", "Line In", - "Line", "Line Out"; + simple-audio-card,widgets = + "Line", "Line In", + "Line", "Line Out"; - simple-audio-card,routing = - "Line Out","AOUTA+", - "Line Out","AOUTA-", - "Line Out","AOUTB+", - "Line Out","AOUTB-", - "AINA","Line In", - "AINB","Line In"; + simple-audio-card,routing = + "Line Out","AOUTA+", + "Line Out","AOUTA-", + "Line Out","AOUTB+", + "Line Out","AOUTB-", + "AINA","Line In", + "AINB","Line In"; - simple-audio-card,format = "i2s"; + simple-audio-card,format = "i2s"; simple-audio-card,bitclock-master = <&sound_master>; simple-audio-card,frame-master = <&sound_master>; - simple-audio-card,cpu { - sound-dai = <&i2s>; + simple-audio-card,cpu { + sound-dai = <&i2s>; dai-tdm-slot-num = <2>; dai-tdm-slot-width = <32>; - }; + }; - sound_master: simple-audio-card,codec { - sound-dai = <&cs4271>; - system-clock-frequency = <24576000>; - }; + sound_master: simple-audio-card,codec { + sound-dai = <&cs4271>; + system-clock-frequency = <24576000>; + }; }; }; @@ -67,7 +67,7 @@ }; }; }; - __overrides__ { - gpiopin = <&cs4271>,"reset-gpio:4"; - }; + __overrides__ { + gpiopin = <&cs4271>,"reset-gpio:4"; + }; }; From 8de5335a3aa305fcccb3c6b969318acaaa575d07 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 18 Feb 2018 20:39:18 +0000 Subject: [PATCH 6/6] bcmrpi3_defconfig: correct order --- arch/arm64/configs/bcmrpi3_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig index ed28d685220eb7..1352f5d343e030 100644 --- a/arch/arm64/configs/bcmrpi3_defconfig +++ b/arch/arm64/configs/bcmrpi3_defconfig @@ -872,9 +872,9 @@ CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m CONFIG_SND_PISOUND=m CONFIG_SND_SOC_ADAU1701=m CONFIG_SND_SOC_AK4554=m +CONFIG_SND_SOC_CS4271_I2C=m CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m -CONFIG_SND_SOC_CS4271_I2C=m CONFIG_SOUND_PRIME=m CONFIG_HIDRAW=y CONFIG_UHID=m