User avatar
PeterO
Posts: 4236
Joined: Sun Jul 22, 2012 4:14 pm

STICKY: Device Tree Q&A

Wed Feb 11, 2015 10:09 pm

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
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,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: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Q&A

Thu Feb 12, 2015 10:19 am

The "of" is short for Open Firmware, a Sun BIOS/ACPI alternative.

User avatar
PeterO
Posts: 4236
Joined: Sun Jul 22, 2012 4:14 pm

Re: Device Tree Q&A

Thu Feb 12, 2015 10:34 am

PhilE wrote:The "of" is short for Open Firmware, a Sun BIOS/ACPI alternative.
Ah, I was expecting it to be something more "functional" :-)
Thanks.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,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

Fri Mar 06, 2015 2:22 pm

I'm not sure if this belongs here or in another thread(...)

-edit- moved

Thanks @PhilE
Last edited by ronaldteune on Mon Mar 09, 2015 7:39 pm, edited 3 times in total.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Q&A

Fri Mar 06, 2015 2:24 pm

It definitely belongs in another thread.

Danielya
Posts: 15
Joined: Thu May 04, 2017 12:25 pm

Re: Device Tree Q&A

Mon May 15, 2017 9:39 am

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

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Q&A

Mon May 15, 2017 12:30 pm

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:

Code: Select all

    target = <&sound>;
    __overlay__ {
        ...whatever...
    };
to (notice the extra level in the hierarchy):

Code: Select all

    target = <&soc>;
    __overlay__ {
        soundinput {
            ...whatever...
        };
    };

Danielya
Posts: 15
Joined: Thu May 04, 2017 12:25 pm

Re: Device Tree Q&A

Tue May 16, 2017 2:56 am

Thanks for the help.
Unfortunately it didn't work :(

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Q&A

Tue May 16, 2017 10:48 am

Are there any errors or warnings in the kernel log (type "dmesg")?

sv1eia
Posts: 2
Joined: Mon May 08, 2017 12:43 pm

Re: Device Tree Q&A

Sat May 20, 2017 4:57 pm

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?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Q&A

Sat May 20, 2017 6:56 pm

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".

sv1eia
Posts: 2
Joined: Mon May 08, 2017 12:43 pm

Re: Device Tree Q&A

Sat May 20, 2017 7:04 pm

Thanks, yet since that is a DAC should it also generate the 'capture' device that I need?
(going to try it)

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Device Tree Q&A

Sat May 20, 2017 7:12 pm

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.

michthom
Posts: 12
Joined: Sun Jul 01, 2012 10:46 am

Re: STICKY: Device Tree Q&A

Tue Feb 27, 2018 8:29 pm

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?

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2708";

    [email protected] {
        target = <&sound>;
        __overlay__ {
            compatible = "simple-audio-card";
            simple-audio-card,name = "PiBell";

            status="okay";

            capture_link: simple-audio-card,[email protected] {
                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,[email protected] {
                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>;
                };
            };
        };
    };

    [email protected] {
        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";
            };
        };
    };

    [email protected] {
        target = <&i2s>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";
        };
    };
};
pibell.dts (compiled and installed as /boot/overlays/pibell.dtbo)

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
/boot/config.txt (Preamble comments snipped for brevity)

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
}
.asoundrc file (complete contents)

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

alsa-info output

Code: Select all

arecord -Dhw:PiBell,1 -c2 -r48000 -fS32_LE -twav -d10 -Vstereo test.wav
Recording command

Code: 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       : 0
Playback command and output.

Yours 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: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY: Device Tree Q&A

Tue Feb 27, 2018 9:08 pm

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?
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.
Yours in anticipation of learning how much of a NOOB I am in this area...
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.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY: Device Tree Q&A

Tue Feb 27, 2018 9:24 pm

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.

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
}

michthom
Posts: 12
Joined: Sun Jul 01, 2012 10:46 am

Re: STICKY: Device Tree Q&A

Tue Feb 27, 2018 9:32 pm

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:

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
}
.asoundrc

Code: Select all

arecord -Dmems_mic_l -r48000 -fS32_LE -v -twav -d5 test.wav
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...

michthom
Posts: 12
Joined: Sun Jul 01, 2012 10:46 am

Re: STICKY: Device Tree Q&A

Wed Feb 28, 2018 6:44 pm

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!

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
}
.asoundrc

Code: Select all

$ arecord -Dmems_mic_softvol_l -r48000 -fS32_LE -v -twav -d5 test.wav
Recording command

Code: 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
Playback command and output

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
alsa-info output

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY: Device Tree Q&A

Wed Feb 28, 2018 7:37 pm

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.

michthom
Posts: 12
Joined: Sun Jul 01, 2012 10:46 am

Re: STICKY: Device Tree Q&A

Wed Feb 28, 2018 7:51 pm

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: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY: Device Tree Q&A

Wed Feb 28, 2018 7:57 pm

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: 1819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY: Device Tree Q&A

Wed Feb 28, 2018 9:36 pm

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.

gregeric
Posts: 1511
Joined: Mon Nov 28, 2011 10:08 am

Re: STICKY: Device Tree Q&A

Wed Feb 28, 2018 10:14 pm

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.

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 13 guests