STICKY: Device Tree Q&A
Starting new thread as suggested....
In symbols like "bcm2708_i2s_of_match" what does the "of" bit stand for ? I'm sure things would be clearer if I was reading/saying the symbol names correctly in my head :-)
PeterO
In symbols like "bcm2708_i2s_of_match" what does the "of" bit stand for ? I'm sure things would be clearer if I was reading/saying the symbol names correctly in my head :-)
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PICO,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PICO,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: Device Tree Q&A
The "of" is short for Open Firmware, a Sun BIOS/ACPI alternative.
Re: Device Tree Q&A
Ah, I was expecting it to be something more "functional" :-)PhilE wrote:The "of" is short for Open Firmware, a Sun BIOS/ACPI alternative.
Thanks.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PICO,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PICO,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
- ronaldteune
- Posts: 8
- Joined: Wed Oct 16, 2013 5:39 am
Re: Device Tree Q&A
Last edited by ronaldteune on Mon Mar 09, 2015 7:39 pm, edited 3 times in total.
Re: Device Tree Q&A
Is it possible to create a device tree overlay that defines both speaker and microphone, each connected via I2S?
I have the ICS43432 mic and the HiFiberry DAC speaker. Each one of them works when I define them in /boot/config.txt but when I define both, only the last one written applies...I need them for a project that I must have two-way audio in, and simultaneously...
Thanks in advance
I have the ICS43432 mic and the HiFiberry DAC speaker. Each one of them works when I define them in /boot/config.txt but when I define both, only the last one written applies...I need them for a project that I must have two-way audio in, and simultaneously...
Thanks in advance
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: Device Tree Q&A
I'm not in a position to experiment, but I think that the problem is likely to be caused by both overlays trying to use the node labelled "sound" (which corresponds to the path "/soc/sound" in the Device Tree). If you move one of the sound card instances somewhere else it might start working. I suggest moving the microphone to "/soc/soundinput" (or "/soc/sound2" - it doesn't really matter what you choose as long as it doesn't clash with something else).
Since this node doesn't exist in the base DTBs your overlay will have to create it. Change: to (notice the extra level in the hierarchy):
Since this node doesn't exist in the base DTBs your overlay will have to create it. Change:
Code: Select all
target = <&sound>;
__overlay__ {
...whatever...
};Code: Select all
target = <&soc>;
__overlay__ {
soundinput {
...whatever...
};
};- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: Device Tree Q&A
Are there any errors or warnings in the kernel log (type "dmesg")?
Re: Device Tree Q&A
Hi,
Need to experiment with I2S but without any codec device attached.
From what I read, there can be a way with snd-soc-dummy and simple-audio-card to have just a overlay .dts in such a way that can give user access to I2S as alsa devices.
Is there any example or hint to help me on this?
Need to experiment with I2S but without any codec device attached.
From what I read, there can be a way with snd-soc-dummy and simple-audio-card to have just a overlay .dts in such a way that can give user access to I2S as alsa devices.
Is there any example or hint to help me on this?
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: Device Tree Q&A
Yes you could write an overlay using simple-audio-card, but you could probably get away with the hifiberry-dac overlay. HiFiBerry DAC is built around a PCM5102 which doesn't have an I2C interface so it doesn't need any runtime control - you just feed it an I2S bitstream and it converts it to analogue voltages. The codec is configured as a sample clock slave and bit clock slave. Because there is no feedback from the codec you don't even need to have one attached to get I2S output.
Just add "dtoverlay=hifiberry-dac" to config.txt, or to just try it out until you reboot type "sudo dtoverlay hifiberry-dac".
Just add "dtoverlay=hifiberry-dac" to config.txt, or to just try it out until you reboot type "sudo dtoverlay hifiberry-dac".
Re: Device Tree Q&A
Thanks, yet since that is a DAC should it also generate the 'capture' device that I need?
(going to try it)
(going to try it)
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: Device Tree Q&A
You didn't mention capture. There is already a simple-audio-card capture overlay - see https://github.com/raspberrypi/linux/bl ... verlay.dts
There is a tbread on GitHub that includes a discussion of a SAC-based overlay for a playback card - see https://github.com/raspberrypi/linux/pu ... -298261663
Combining the two is an exercise for the reader.
There is a tbread on GitHub that includes a discussion of a SAC-based overlay for a playback card - see https://github.com/raspberrypi/linux/pu ... -298261663
Combining the two is an exercise for the reader.
Re: STICKY: Device Tree Q&A
This may be better moved to its own topic / thread, but it's in reply to those above, so I thought I'd gamble.
I took PhilE's comment on getting both an I2S microphone and amplifier working together as a challenge: "Combining the two [overlays] is an exercise for the reader."
I was unhappy with the kludge of using the hifiberry_dac overlay for the Adafruit MAX98357-based amplifier (https://learn.adafruit.com/adafruit-max ... p?view=all) when according to some sources that overlay expects the PCM5102 chip, and using the out-of-tree ics43432 module for the Adafruit I2S MEMS microphone (https://learn.adafruit.com/adafruit-i2s ... t/overview) loaded via the Byzantine methods laid out previously here: https://learn.adafruit.com/adafruit-i2s ... g-and-test.
So I crafted a DTS file to enable both devices in a single simple-audio-card overlay , compiled and installed it and now I can both record audio and play back via the speaker!!
What do I win?
Sadly nothing, since I'm stumped trying to reimplement the softvol/mixer/gain control and stereo to mono conversion in my .asoundrc, despite hints in this thread: viewtopic.php?f=44&t=173640
I can't see the "Boost" control in alsamixer, but I can't see any errors popping out either.
So I'm throwing myself on the mercy of the court. What am I missing here? How do I link the device tree nodes and the alsa devices / subdevices together and enable that setting, or have I made that impossible by overlaying on snd_soc_simple_card itself as opposed to one of the derivatives?
pibell.dts (compiled and installed as /boot/overlays/pibell.dtbo)
/boot/config.txt (Preamble comments snipped for brevity)
.asoundrc file (complete contents)
alsa-info output
Recording command
Playback command and output.
Yours in anticipation of learning how much of a NOOB I am in this area...
Mike
I took PhilE's comment on getting both an I2S microphone and amplifier working together as a challenge: "Combining the two [overlays] is an exercise for the reader."
I was unhappy with the kludge of using the hifiberry_dac overlay for the Adafruit MAX98357-based amplifier (https://learn.adafruit.com/adafruit-max ... p?view=all) when according to some sources that overlay expects the PCM5102 chip, and using the out-of-tree ics43432 module for the Adafruit I2S MEMS microphone (https://learn.adafruit.com/adafruit-i2s ... t/overview) loaded via the Byzantine methods laid out previously here: https://learn.adafruit.com/adafruit-i2s ... g-and-test.
So I crafted a DTS file to enable both devices in a single simple-audio-card overlay , compiled and installed it and now I can both record audio and play back via the speaker!!
What do I win?
Sadly nothing, since I'm stumped trying to reimplement the softvol/mixer/gain control and stereo to mono conversion in my .asoundrc, despite hints in this thread: viewtopic.php?f=44&t=173640
I can't see the "Boost" control in alsamixer, but I can't see any errors popping out either.
So I'm throwing myself on the mercy of the court. What am I missing here? How do I link the device tree nodes and the alsa devices / subdevices together and enable that setting, or have I made that impossible by overlaying on snd_soc_simple_card itself as opposed to one of the derivatives?
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
simple-audio-card,name = "PiBell";
status="okay";
capture_link: simple-audio-card,dai-link@0 {
format = "i2s";
r_cpu_dai: cpu {
sound-dai = <&i2s>;
/* example TDM slot configuration
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
*/
};
r_codec_dai: codec {
sound-dai = <&codec_in>;
};
};
playback_link: simple-audio-card,dai-link@1 {
format = "i2s";
p_cpu_dai: cpu {
sound-dai = <&i2s>;
/* example TDM slot configuration
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
*/
};
p_codec_dai: codec {
sound-dai = <&codec_out>;
};
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
codec_out: spdif-transmitter {
#address-cells = <0>;
#size-cells = <0>;
#sound-dai-cells = <0>;
compatible = "linux,spdif-dit";
status = "okay";
};
codec_in: card-codec {
#sound-dai-cells = <0>;
compatible = "invensense,ics43432";
status = "okay";
};
};
};
fragment@2 {
target = <&i2s>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};
};
Code: Select all
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
# dtparam=audio=on
start_x=1
gpu_mem=128
# I2S Peripherals
dtoverlay=pibell,alsaname=PiBell
Code: Select all
pcm.dmic_hw{
type hw
card PiBell
device 1
subdevice 0
channels 2
format S32_LE
}
pcm.dmic_sv{
type softvol
slave.pcm dmic_hw
control {
name "Boost"
card PiBell
}
min_dB -3.0
max_dB 50.0
}
Code: Select all
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.64
!!################################
!!Script ran on: Tue Feb 27 19:45:59 UTC 2018
!!Linux Distribution
!!------------------
ID_LIKE=debian
!!DMI Information
!!---------------
Manufacturer:
Product Name:
Product Version:
Firmware Version:
!!Kernel Information
!!------------------
Kernel release: 4.9.59-v7+
Operating System: GNU/Linux
Architecture: armv7l
Processor: unknown
SMP Enabled: Yes
!!ALSA Version
!!------------
Driver version: k4.9.59-v7+
Library version: 1.1.3
Utilities version: 1.1.3
!!Loaded ALSA modules
!!-------------------
snd_soc_simple_card
!!Sound Servers on this system
!!----------------------------
Jack:
Installed - Yes (/usr/bin/jackd)
Running - No
!!Soundcards recognised by ALSA
!!-----------------------------
0 [PiBell ]: PiBell - PiBell
PiBell
!!Modprobe options (Sound related)
!!--------------------------------
snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
!!Loaded sound module options
!!---------------------------
!!Module: snd_soc_simple_card
* :
!!ALSA Device nodes
!!-----------------
crw-rw---- 1 root audio 116, 0 Feb 26 20:43 /dev/snd/controlC0
crw-rw---- 1 root audio 116, 16 Feb 26 20:43 /dev/snd/pcmC0D0p
crw-rw---- 1 root audio 116, 25 Feb 26 20:43 /dev/snd/pcmC0D1c
crw-rw---- 1 root audio 116, 1 Feb 26 20:43 /dev/snd/seq
crw-rw---- 1 root audio 116, 33 Feb 26 20:43 /dev/snd/timer
/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 60 Feb 26 20:43 .
drwxr-xr-x 3 root root 160 Feb 26 20:43 ..
lrwxrwxrwx 1 root root 12 Feb 26 20:43 platform-soc:sound -> ../controlC0
!!ALSA configuration files
!!------------------------
!!User specific config file (~/.asoundrc)
pcm.dmic_hw{
type hw
card PiBell
device 1
subdevice 0
channels 2
format S32_LE
}
pcm.dmic_sv{
type softvol
slave.pcm dmic_hw
control {
name "Boost"
card PiBell
}
min_dB -3.0
max_dB 50.0
}
!!Aplay/Arecord output
!!--------------------
APLAY
**** List of PLAYBACK Hardware Devices ****
card 0: PiBell [PiBell], device 0: bcm2835-i2s-dit-hifi dit-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
ARECORD
**** List of CAPTURE Hardware Devices ****
card 0: PiBell [PiBell], device 1: bcm2835-i2s-ics43432-hifi ics43432-hifi-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
!!Amixer output
!!-------------
!!-------Mixer controls for card 0 [PiBell]
Card hw:0 'PiBell'/'PiBell'
Mixer name : ''
Components : ''
Controls : 1
Simple ctrls : 1
Simple mixer control 'PCM',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 255
Front Left: 255 [100%]
Front Right: 255 [100%]
!!Alsactl output
!!--------------
--startcollapse--
state.PiBell {
control.1 {
iface MIXER
name PCM
value.0 255
value.1 255
comment {
access 'read write user'
type INTEGER
count 2
range '0 - 255'
tlv '0000000100000008ffffec1400000014'
dbmin -5100
dbmax 0
dbvalue.0 0
dbvalue.1 0
}
}
}
--endcollapse--
!!All Loaded Modules
!!------------------
Module
binfmt_misc
rfcomm
cmac
bnep
hci_uart
btbcm
bluetooth
brcmfmac
brcmutil
cfg80211
rfkill
snd_soc_simple_card
snd_soc_spdif_tx
snd_soc_simple_card_utils
snd_soc_bcm2835_i2s
ics43432
snd_soc_core
snd_compress
snd_pcm_dmaengine
bcm2835_gpiomem
snd_pcm
snd_timer
snd
fixed
uio_pdrv_genirq
uio
i2c_dev
ip_tables
x_tables
ipv6
!!ALSA/HDA dmesg
!!--------------
[ 3.080084] ics43432: loading out-of-tree module taints kernel.
[ 3.176079] asoc-simple-card soc:sound: dit-hifi <-> 3f203000.i2s mapping ok
[ 3.177231] asoc-simple-card soc:sound: ics43432-hifi <-> 3f203000.i2s mapping ok
[ 3.329370] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
Code: Select all
arecord -Dhw:PiBell,1 -c2 -r48000 -fS32_LE -twav -d10 -Vstereo test.wavCode: Select all
$ aplay -v test.wav
Playing WAVE 'test.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Linear conversion PCM (S24_LE)
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S32_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 32
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
Slave: Hardware PCM card 0 'PiBell' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S24_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 32
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0Yours in anticipation of learning how much of a NOOB I am in this area...
Mike
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: STICKY: Device Tree Q&A
Congratulations on a real achievement - Device Tree is tricky enough to start with, adding overlays makes it harder still, and ALSA can be the final straw.So I crafted a DTS file to enable both devices in a single simple-audio-card overlay , compiled and installed it and now I can both record audio and play back via the speaker!!
What do I win?
You left NOOB territory many miles ago - this is advanced stuff, and I'm going to have to do some research to understand the problem unless HiassofT sees our plight and takes pity on us.Yours in anticipation of learning how much of a NOOB I am in this area...
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: STICKY: Device Tree Q&A
I found these bits of documentation that may help:
https://alsa.opensrc.org/How_to_use_sof ... ter_volume
http://www.alsa-project.org/alsa-doc/al ... cm_plugins
Is this any better? I've changed the slave declaration to match their example, quoted the strings and used an index for the card rather than a name.
https://alsa.opensrc.org/How_to_use_sof ... ter_volume
http://www.alsa-project.org/alsa-doc/al ... cm_plugins
Is this any better? I've changed the slave declaration to match their example, quoted the strings and used an index for the card rather than a name.
Code: Select all
pcm.dmic_sv{
type softvol
slave {
pcm "dmic_hw"
}
control {
name "Boost"
card 0
}
min_dB -3.0
max_dB 50.0
}Re: STICKY: Device Tree Q&A
PhilE, your suggested .asoundrc isn't immediately producing a Boost control, so I'll read the links in more depth and see if I can come up with a variation that does. Thanks for the super-swift replies though!
I did get help from the Alsa docs you referenced - at least the dnsoop page (https://alsa.opensrc.org/Dsnoop) was enough to clue me in on converting my "half-stereo" to "proper mono", see below:
.asoundrc
Record in glorious monophonic sound...
But despite study of the .asoundrc and softvol docs (https://alsa.opensrc.org/Asoundrc, https://alsa.opensrc.org/Softvol, https://alsa.opensrc.org/How_to_use_sof ... ter_volume) I'm still clueless as to why the code referenced in other places (viewtopic.php?t=204133, https://forums.adafruit.com/viewtopic.php?f=19&t=117687) doesn't work for me to add a boost/preamp control.
I did get sidetracked into trying many iterations of "standard" control labels as discussed here (https://01.org/linuxgraphics/gfx-docs/d ... names.html, https://elixir.bootlin.com/linux/v4.1/s ... lNames.txt) but again it seems I'm farming red herrings at an industrial rate...
I did get help from the Alsa docs you referenced - at least the dnsoop page (https://alsa.opensrc.org/Dsnoop) was enough to clue me in on converting my "half-stereo" to "proper mono", see below:
Code: Select all
pcm.mems_mic {
type hw
card "PiBell"
device 1
subdevice 0
channels 2
rate 48000
format S32_LE
}
pcm.mems_mic_l {
type dsnoop
ipc_key 3153086
ipc_key_add_uid true
slave {
pcm "mems_mic"
channels 2
}
bindings.0 0
}
pcm.mems_mic_r {
type dsnoop
ipc_key 4498692
ipc_key_add_uid true
slave {
pcm "mems_mic"
channels 2
}
bindings.0 1
}
Code: Select all
arecord -Dmems_mic_l -r48000 -fS32_LE -v -twav -d5 test.wavBut despite study of the .asoundrc and softvol docs (https://alsa.opensrc.org/Asoundrc, https://alsa.opensrc.org/Softvol, https://alsa.opensrc.org/How_to_use_sof ... ter_volume) I'm still clueless as to why the code referenced in other places (viewtopic.php?t=204133, https://forums.adafruit.com/viewtopic.php?f=19&t=117687) doesn't work for me to add a boost/preamp control.
I did get sidetracked into trying many iterations of "standard" control labels as discussed here (https://01.org/linuxgraphics/gfx-docs/d ... names.html, https://elixir.bootlin.com/linux/v4.1/s ... lNames.txt) but again it seems I'm farming red herrings at an industrial rate...
Re: STICKY: Device Tree Q&A
By George, I think he's got it!
With approximately 21dB of gain on the MEMS microphone I'm getting some hiss but not horrendous clipping. Driving it to the maximum (max_dB can be set to arbitrary numbers but 30dB seems to be an enforced limit) results in audio breaking up - possibly due to DC offsets swamping the signal?
But I have what I need - mono audio at reasonable levels, and a single DTS / asoundrc combination with no module hackery required.
Now to actually build the project! A Pi-powered PJSIP two-way audio and video gate entry system!
.asoundrc
Recording command
Playback command and output
alsa-info output
With approximately 21dB of gain on the MEMS microphone I'm getting some hiss but not horrendous clipping. Driving it to the maximum (max_dB can be set to arbitrary numbers but 30dB seems to be an enforced limit) results in audio breaking up - possibly due to DC offsets swamping the signal?
But I have what I need - mono audio at reasonable levels, and a single DTS / asoundrc combination with no module hackery required.
Now to actually build the project! A Pi-powered PJSIP two-way audio and video gate entry system!
Code: Select all
pcm.mems_mic {
type hw
card "PiBell"
device 1
subdevice 0
channels 2
rate 48000
format S32_LE
}
pcm.mems_mic_l {
type dsnoop
ipc_key 3153086
ipc_key_add_uid true
slave {
pcm "mems_mic"
channels 2
}
bindings.0 0
}
pcm.mems_mic_r {
type dsnoop
ipc_key 4498692
ipc_key_add_uid true
slave {
pcm "mems_mic"
channels 2
}
bindings.0 1
}
pcm.mems_mic_softvol_l {
type softvol
slave {
pcm "mems_mic_l"
}
control {
name "Boost Capture Volume"
card "PiBell"
}
min_dB -3.0
max_dB 30.0
}
Code: Select all
$ arecord -Dmems_mic_softvol_l -r48000 -fS32_LE -v -twav -d5 test.wavCode: Select all
$ aplay -v test.wav
Playing WAVE 'test.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Mono
Plug PCM: Route conversion PCM (sformat=S24_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S32_LE
subformat : STD
channels : 1
rate : 48000
exact rate : 48000 (48000/1)
msbits : 32
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
Slave: Hardware PCM card 0 'PiBell' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S24_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 32
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0
Code: Select all
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.64
!!################################
!!Script ran on: Wed Feb 28 18:37:18 UTC 2018
!!Linux Distribution
!!------------------
ID_LIKE=debian
!!DMI Information
!!---------------
Manufacturer:
Product Name:
Product Version:
Firmware Version:
!!Kernel Information
!!------------------
Kernel release: 4.9.59-v7+
Operating System: GNU/Linux
Architecture: armv7l
Processor: unknown
SMP Enabled: Yes
!!ALSA Version
!!------------
Driver version: k4.9.59-v7+
Library version: 1.1.3
Utilities version: 1.1.3
!!Loaded ALSA modules
!!-------------------
snd_soc_simple_card
!!Sound Servers on this system
!!----------------------------
Jack:
Installed - Yes (/usr/bin/jackd)
Running - No
!!Soundcards recognised by ALSA
!!-----------------------------
0 [PiBell ]: PiBell - PiBell
PiBell
!!Modprobe options (Sound related)
!!--------------------------------
snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
!!Loaded sound module options
!!---------------------------
!!Module: snd_soc_simple_card
* :
!!ALSA Device nodes
!!-----------------
crw-rw---- 1 root audio 116, 0 Feb 28 18:28 /dev/snd/controlC0
crw-rw---- 1 root audio 116, 16 Feb 28 18:28 /dev/snd/pcmC0D0p
crw-rw---- 1 root audio 116, 25 Feb 28 18:28 /dev/snd/pcmC0D1c
crw-rw---- 1 root audio 116, 1 Feb 28 18:28 /dev/snd/seq
crw-rw---- 1 root audio 116, 33 Feb 28 18:28 /dev/snd/timer
/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 60 Feb 28 18:28 .
drwxr-xr-x 3 root root 160 Feb 28 18:28 ..
lrwxrwxrwx 1 root root 12 Feb 28 18:28 platform-soc:sound -> ../controlC0
!!ALSA configuration files
!!------------------------
!!User specific config file (~/.asoundrc)
pcm.mems_mic {
type hw
card "PiBell"
device 1
subdevice 0
channels 2
rate 48000
format S32_LE
}
pcm.mems_mic_l {
type dsnoop
ipc_key 3153086
ipc_key_add_uid true
slave {
pcm "mems_mic"
channels 2
}
bindings.0 0
}
pcm.mems_mic_r {
type dsnoop
ipc_key 4498692
ipc_key_add_uid true
slave {
pcm "mems_mic"
channels 2
}
bindings.0 1
}
pcm.mems_mic_softvol_l {
type softvol
slave {
pcm "mems_mic_l"
}
control {
name "Boost Capture Volume"
card "PiBell"
}
min_dB -3.0
max_dB 30.0
}
!!Aplay/Arecord output
!!--------------------
APLAY
**** List of PLAYBACK Hardware Devices ****
card 0: PiBell [PiBell], device 0: bcm2835-i2s-dit-hifi dit-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
ARECORD
**** List of CAPTURE Hardware Devices ****
card 0: PiBell [PiBell], device 1: bcm2835-i2s-ics43432-hifi ics43432-hifi-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
!!Amixer output
!!-------------
!!-------Mixer controls for card 0 [PiBell]
Card hw:0 'PiBell'/'PiBell'
Mixer name : ''
Components : ''
Controls : 2
Simple ctrls : 2
Simple mixer control 'PCM',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 255
Front Left: 255 [100%]
Front Right: 255 [100%]
Simple mixer control 'Boost',0
Capabilities: cvolume
Capture channels: Front Left - Front Right
Limits: Capture 0 - 255
Front Left: Capture 199 [78%] [20.88dB]
Front Right: Capture 199 [78%] [20.88dB]
!!Alsactl output
!!--------------
--startcollapse--
state.PiBell {
control.1 {
iface MIXER
name PCM
value.0 255
value.1 255
comment {
access 'read write user'
type INTEGER
count 2
range '0 - 255'
tlv '0000000100000008ffffec1400000014'
dbmin -5100
dbmax 0
dbvalue.0 0
dbvalue.1 0
}
}
control.2 {
iface MIXER
name 'Boost Capture Volume'
value.0 199
value.1 199
comment {
access 'read write user'
type INTEGER
count 2
range '0 - 255'
tlv '0000000100000008fffffed40000000c'
dbmin -300
dbmax 2760
dbvalue.0 2088
dbvalue.1 2088
}
}
}
--endcollapse--
!!All Loaded Modules
!!------------------
Module
rfcomm
cmac
bnep
hci_uart
btbcm
bluetooth
brcmfmac
brcmutil
cfg80211
rfkill
snd_soc_spdif_tx
snd_soc_simple_card
snd_soc_simple_card_utils
snd_soc_bcm2835_i2s
ics43432
snd_soc_core
bcm2835_gpiomem
snd_compress
snd_pcm_dmaengine
snd_pcm
snd_timer
snd
uio_pdrv_genirq
uio
fixed
i2c_dev
ip_tables
x_tables
ipv6
!!ALSA/HDA dmesg
!!--------------
[ 3.044366] ics43432: loading out-of-tree module taints kernel.
[ 3.101486] asoc-simple-card soc:sound: dit-hifi <-> 3f203000.i2s mapping ok
[ 3.102410] asoc-simple-card soc:sound: ics43432-hifi <-> 3f203000.i2s mapping ok
[ 3.255384] brcmfmac: F1 signature read @0x18000000=0x1541a9a6- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: STICKY: Device Tree Q&A
That's a result! You'd would be justified in feeling a bit smug.
I'll gladly add your overlay to the raspberrypi/linux GitHub repo when the time comes - simple card examples are always welcome.
I'll gladly add your overlay to the raspberrypi/linux GitHub repo when the time comes - simple card examples are always welcome.
Re: STICKY: Device Tree Q&A
Thanks - as with most technical things these days it's the helpful community putting the right info under inquisitive or just plain stubborn noses to make progress happen. By all means reuse the info above and I'll try to report back on the project later if any significant differences develop.
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: STICKY: Device Tree Q&A
I'll hook up the "alsaname" parameter you are using, add it as "pibell-overlay.dts" and post a link.
- PhilE
- Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator - Posts: 6874
- Joined: Mon Sep 29, 2014 1:07 pm
Re: STICKY: Device Tree Q&A
The tweaked overlay is here. I shuffled the fragment order because I've found in the past that putting the cpu and codec before the sound card that uses them can avoid problems when the overlay is loaded dynamically from the command line.
Re: STICKY: Device Tree Q&A
Great stuff mitchthom - I tried and failed to get capture & playback working with the simple card driver.
I'd recently noticed that the half-stereo to true mono alsa stuff had stopped working since I posted in that thread a year ago. I'll see how your solution compares to my workaround.
I'd recently noticed that the half-stereo to true mono alsa stuff had stopped working since I posted in that thread a year ago. I'll see how your solution compares to my workaround.
Re: STICKY: Device Tree Q&A
Can you please post the code of your crafted DTS file?michthom wrote: ↑Tue Feb 27, 2018 8:29 pmThis may be better moved to its own topic / thread, but it's in reply to those above, so I thought I'd gamble.
I took PhilE's comment on getting both an I2S microphone and amplifier working together as a challenge: "Combining the two [overlays] is an exercise for the reader."
I was unhappy with the kludge of using the hifiberry_dac overlay for the Adafruit MAX98357-based amplifier (https://learn.adafruit.com/adafruit-max ... p?view=all) when according to some sources that overlay expects the PCM5102 chip, and using the out-of-tree ics43432 module for the Adafruit I2S MEMS microphone (https://learn.adafruit.com/adafruit-i2s ... t/overview) loaded via the Byzantine methods laid out previously here: https://learn.adafruit.com/adafruit-i2s ... g-and-test.
So I crafted a DTS file to enable both devices in a single simple-audio-card overlay , compiled and installed it and now I can both record audio and play back via the speaker!!
I try to bring a Hifiberry-DAC and a DABboard together. Both use I2S. I already build my own Hfifberry-DAC overlay:
Code: Select all
// Definitions for HiFiBerry DAC
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
target = <&soc>;
__overlay__ {
soundinput{
compatible = "hifiberry,hifiberry-dac";
i2s-controller = <&i2s>;
status = "okay";
};
};
};
fragment@1 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target-path = "/";
__overlay__ {
pcm5102a-codec {
#sound-dai-cells = <0>;
compatible = "ti,pcm5102a";
status = "okay";
};
};
};
};
But still no success. DMESG shows:Since this node doesn't exist in the base DTBs your overlay will have to create it. Change:
to (notice the extra level in the hierarchy):Code: Select all
target = <&sound>; __overlay__ { ...whatever... };Code: Select all
target = <&soc>; __overlay__ { soundinput { ...whatever... }; };
Code: Select all
pi@raspberrypi:~ $ dmesg | grep hifi
[ 3.801574] audiosense-snd-card soc:sound: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[ 3.855766] snd-rpi-simple soc:soundinput: pcm5102a-hifi <-> 3f203000.i2s mapping ok
[ 3.857078] audiosense-snd-card soc:sound: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[ 3.995812] audiosense-snd-card soc:sound: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[ 3.996921] audiosense-snd-card soc:sound: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[ 4.058119] bcm2835-i2s 3f203000.i2s: Trying to bind component to card "audiosense-pi" but is already bound to card "snd_rpi_hifiberry_dac"
Return to "Interfacing (DSI, CSI, I2C, etc.)"
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion