[RPI] More work on getting the wm8960 2-mic card to work properly

This commit is contained in:
j1nx 2023-12-12 09:07:53 +00:00
parent 4acfa1202c
commit 47776bd4aa
5 changed files with 69 additions and 24 deletions

View File

@ -0,0 +1,3 @@
options snd_soc_simple_card index=0
options snd_bcm2835 index=1
options snd slots=snd-soc-simple-card,snd-bcm2835

View File

@ -16,10 +16,10 @@
##########################################################################
# Scanning the I2C bus for know addresses
is_1a=$(i2cdetect -y 1 0x1a 0x1a | grep -E "(1a|UU)" | awk '{print $2}') # ReSpeaker 2-mic / WM8960
is_1a=$(i2cdetect -y 1 0x1a 0x1a | grep -E "(1a|UU)" | awk '{print $2}') # ReSpeaker 2-mic / WM8960 based
if [ "${is_1a}" == "1a" ] || [ "${is_1a}" == "UU" ] ; then
RESPEAKER2=found
echo "ReSpeaker 2-mic $RESPEAKER2"
WM8960=found
echo "WM8960 based 2-mic $WM8960"
fi
is_35=$(i2cdetect -y 1 0x35 0x35 | grep -E "(35|UU)" | awk '{print $2}') # ReSpeaker 4-mic squared
@ -59,30 +59,31 @@ if [ "${is_04}" == "04" ] || [ "${is_04}" == "UU" ] ; then
fi
# Configure found devices
if [ "$RESPEAKER2" == "found" ] && [ "$RESPEAKER4" != "found" ] ; then
if [ "$WM8960" == "found" ] && [ "$RESPEAKER4" != "found" ] ; then
echo "Installing and configuring WM8960 based 2-mic HAT"
dtoverlay wm8960-soundcard
echo "Configuring board"
amixer cset numid=1 34,34
amixer cset numid=26 3
amixer cset numid=27 4
amixer cset numid=30 5
amixer cset numid=32 5
amixer cset numid=33 5
amixer cset numid=34 25
amixer cset numid=35 on
amixer cset numid=9 3
amixer cset numid=8 3
amixer cset numid=49 on
amixer cset numid=51 on
amixer cset numid=37 0
amixer cset numid=38 0
amixer cset numid=39 5
amixer cset numid=48 on
amixer cset numid=50 on
amixer cset numid=54 on
amixer cset numid=16 5
amixer cset numid=15 4
amixer -c "wm8960soundcard" cset numid=1 34,34
amixer -c "wm8960soundcard" cset numid=26 3
amixer -c "wm8960soundcard" cset numid=27 4
amixer -c "wm8960soundcard" cset numid=30 5
amixer -c "wm8960soundcard" cset numid=32 5
amixer -c "wm8960soundcard" cset numid=33 5
amixer -c "wm8960soundcard" cset numid=34 25
amixer -c "wm8960soundcard" cset numid=35 on
amixer -c "wm8960soundcard" cset numid=9 3
amixer -c "wm8960soundcard" cset numid=8 3
amixer -c "wm8960soundcard" cset numid=49 on
amixer -c "wm8960soundcard" cset numid=51 on
amixer -c "wm8960soundcard" cset numid=37 0
amixer -c "wm8960soundcard" cset numid=38 0
amixer -c "wm8960soundcard" cset numid=39 5
amixer -c "wm8960soundcard" cset numid=48 on
amixer -c "wm8960soundcard" cset numid=50 on
amixer -c "wm8960soundcard" cset numid=54 on
amixer -c "wm8960soundcard" cset numid=16 5
amixer -c "wm8960soundcard" cset numid=15 4
alsactl store
fi
if [ "${RESPEAKER6}" == "found" ] && [ "${RESPEAKER4}" != "found" ] ; then

View File

@ -20,6 +20,8 @@ define RESPEAKER_INSTALL_TARGET_CMDS
mkdir -p $(BINARIES_DIR)/rpi-firmware/overlays
$(INSTALL) -D -m 0644 $(@D)/seeed-4mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
$(INSTALL) -D -m 0644 $(@D)/seeed-8mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/respeaker/wm8960-button-overlay.dtbo \
$(BINARIES_DIR)/rpi-firmware/overlays/
mkdir -p $(TARGET_DIR)/usr/share/pulseaudio/alsa-mixer/profile-sets/
$(INSTALL) -D -m 0644 $(@D)/pulseaudio/pulse_config_4mic/seeed-voicecard.conf \

View File

@ -0,0 +1,39 @@
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&gpio>;
__overlay__ {
wm8960_key_pin: wm8960_key_pin {
brcm,pins = <11>;
brcm,function = <0>; /* input mode */
brcm,pull = <0>; /* pull up/down disabled */
};
};
};
fragment@1 {
target-path = "/soc";
__overlay__ {
wm8960_button: wm8960_button {
compatible = "gpio-keys";
// #address-cells = <1>;
// #size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&wm8960_key_pin>;
status = "okay";
debounce-interval = <50>;
button_wake_up: button@11 {
gpios = <&gpio 11 1>;
linux,code = <143>; // KEY_WAKEUP
label = "Wake Up";
gpio-key,wakeup;
};
};
};
};
};