Neo 1973 audio subsystem

From Openmoko

Revision as of 03:05, 27 November 2007 by TuukkaH (Talk | contribs)

Jump to: navigation, search

In the center of the Neo1973 audio subsystem is the WM8753 (the "Wolfson Codec"), which implements record (ADCs), playback (DACs), and signal mixing. On the stereo output is the LM4857 amplifier, which drives the stereo speakers, the mono earpiece and the headphones. Sound from and to GSM is received from and sent to the GSM modem via analog connections. There's a digital mono interface for sound from and to the Bluetooth chip.

Contents

Phase0 Quick Start

In my experience this works but I have to fiddle with the connection a bit before I get stereo output. The audio also comes out both the speaker and headphones.

alsactl -f /etc/stereoout.state restore
madplay myfavoritesong.mp3

Another simple test (assuming you have USB Networking configured) is to listen to a radio stream:

wget -O - http://radioparadise.steadyhost.com:8050 | madplay -

If for some reason you're missing stereoout.state, try getting a similar copy (a couple of volume levels are different is all)

 wget http://opensource.wolfsonmicro.com/~gg/neo1973/stereoout.state

Voice Calls

using phone-internal microphone and speaker

WM8753 BlockDiagram GSM handset.png

This is the default case.

  • microphone path
    • input: built in microphone attached to wolfson MIC2/MIC2N
    • routed from wolfson MIC2/MIC2N to MONO1/MONO2
    • arrives at GSM Modem input MICIP/MICIN
  • speaker path
    • input: GSM Modem attached to wolfson RXN/RXP
    • routed from wolfson RXN/RXP to ROUT1/LOUT1
    • arrives on LM4857 RIN/LIN
    • routed on LM4856 to EP+/EP-
Internal Codec Route

Neo Mode is GSM Handset Amp Mode is Call Speaker

  • audio path Mic -> GSM
    • MIC2/MIC2N
    • Mic2 Volume
    • ALC Micer Mic2
    • Left PGA
    • Mic Sidetone Mux [Left PGA]
    • Mono Sidetone Volume
    • Mono Mixer Sidetone Playback Switch
    • Mono Volume
    • Mono 2 Mux [Inverted Mono 1]
  • audio path GSM -> Speaker
    • RXP/RXN
    • Rx Mixer [RXP - RXN]
    • Line Left Mux [Rx Mix]/Line Right Mux [Rx Mix]
    • Left Mixer Bypass Playback Switch/Right Mixer Bypass Playback Switch
    • Headphone Volume
Driver Status

This should be supported by ASoC 0.13rc3 (-moko7 kernel) on.

ASoC 0.13.3 should have same functionality but has renamed the soundcard to neo1973.

asound.state

https://people.openmoko.org/laforge/gta01/gta01b_v2/alsa/gsmhandset.state

For ASoC 0.13.3 http://opensource.wolfsonmicro.com/~gg/neo1973/gsmhandset.state

using analog (4pin 2.5mm) headset

This is also a quite common case, since we ship the headset with the phone

Headset Detection is done via GPIO on S3C2410

  • microphone path
    • input: headset mic vial HS_MIC attached to wolfson MIC1
    • routed from wolfson MIC1 to MONO1/MONO2
    • arrives at GSM Modem input MICIP/MICIN
  • speaker path
    • input: GSM Modem attached to wolfson RXN/RXP
    • routed from wolfson RXN/RXP to ROUT1/LOUT1
    • arrives on LM4857 RIN/LIN
    • routed on LM4856 to LHP/RHP
Internal Codec Route

Neo Mode is GSM Headset Amp Mode is Headphones

  • audio path Mic -> GSM
    • MIC1
    • Mic Selection Mux [Mic 1]
    • ALC Mixer Mic1
    • Left PGA
    • Mic Sidetone Mux [Left PGA]
    • Mono Sidetone Volume
    • Mono Mixer Sidetone Playback Switch
    • Mono Volume
    • Mono 2 Mux [Inverted Mono 1]
  • Audio path GSM -> Headphones
    • RXP/RXN
    • Rx Mixer [RXP - RXN]
    • Line Left Mux [Rx Mix]/Line Right Mux [Rx Mix]
    • Left Mixer Bypass Playback Switch/Right Mixer Bypass Playback Switch
    • Headphone Volume
Driver Status

Supported in ASoC 0.13.3

asound.state

http://opensource.wolfsonmicro.com/~gg/neo1973/gsmheadset.state

using Bluetooth headset with GSM

WM8753 BlockDiagram GSM Bluetooth.png

Headset detection via software

  • microphone path
    • input: from bluetooth via PCM interface to wolfson
    • wolfson: DAC
    • wolfson routes analog signal to MONO1/MONO2
    • arrives at GSM Modem input MICIP/MICIN
  • speaker path
    • input: GSM Modem attached to wolfson RXN/RXP
    • wolfson: ADC
    • wolfson: routes digital signal to PCM
    • arrives on bluetooth chip via PCM
Internal Codec Route

Neo Mode is GSM Bluetooth Amp Mode is Off

  • audio path BT -> GSM
    • Vx DAC
    • Mono Voice Volume
    • Mono Mixer Voice Playback Switch
    • Mono Volume
    • Mono 2 Mux [Inverted Mono 1]
  • audio path GSM -> BT
    • RXP/RXN
    • Rx Mixer [RXP - RXN]
    • ALC Mixer Rx
    • Left PGA
    • Capture Mixer Mux [PGA]
    • Capture Left Mixer [Analogue Mix Left]
    • Left ADC
Driver Status

Should be support by ASoC 0.13.3

Example of how to setup PCM->BT link.

http://opensource.wolfsonmicro.com/~gg/bluetooth-pcm/bluetooth_pcm.c

asound.state

http://opensource.wolfsonmicro.com/~gg/neo1973/gsmbluetooth.state

Bluetooth headset with system audio

For example, using a voip app on the phone with a bt voice headset. This would also be a good way to work on the bluetooth driver without requiring a working GSM and placing a lot of calls.

See ticket 583 for a state file that should route system audio *out* to the headset. The codec does not allow for duplex system audio connected to a headset, so audio in is still using the mic.

Multimedia

sound playback to speakers

This is an important mode since it is also required for ringtone playback

  • speaker path
    • input: from S3C2410 via IIS interface to wolfson
    • wolfson: DAC
    • wolfson: route to ROUT1/LOUT1
    • LM4857: arrives on RIN/LIN
    • LM4857: route to LLS+-/RLS+-
Driver Status

This is working since ASoC 0.13rc2 (-moko6 kernel)

This should also work on ASoC 0.13.3

asound.state

https://people.openmoko.org/laforge/gta01/gta01b_v2/alsa/stereoout.state

For ASoC 0.13.3 http://opensource.wolfsonmicro.com/~gg/neo1973/stereoout.state

sound playback to headphone

  • speaker path
    • input: from S3C2410 via IIS interface to wolfson
    • wolfson: DAC
    • wolfson: route to ROUT1/LOUT1
    • LM4857: arrives on RIN/LIN
    • routed on LM4856 to LHP/RHP
Driver Status

This is working since ASoC 0.13rc2 (-moko6 kernel)

sound playback via A2DP

One way to do this is to use a pulse plugin for bluetooth audio. Pulse would be routed either to the plugin or the default route to the codec. The plugin would watch for headset connect/disconnect events generated by a bluez audio daemon to keep the list of available output devices current.

Driver Status

There is early work on the bluez daemon to handle this. It has been combined with an alsa plugin in the bluez tree but the alsa plugin probably will not be sufficient for neo.

voice recording

This is mainly used to record notes

  • microphone path
    • can be from built-in mic
    • or from headset
    • or bluetooth headset
Driver Status

UNKNOWN

Call recording

This is a nice wishlist item. The user should be able to receive the full-duplex audio from the wolfson codec, and record it using the S3C2410 IIS.

recording

FIXME

Driver Status

UNKNOWN

playback

FIXME

Driver Status

UNKNOWN

Userspace Sound Control Daemon

The userspace sound control deamon might be a separate process or (more likely) part of some larger general hardware management daemon.


It will provide the following features:

audio playback

In order to provide the desired functionality, the daemon first needs to be capable of doing audio playback.

  • supported formats
    • mp3 (libmad)
    • ogg/vorbis (libtremor)
    • mod (mikmod)
    • sid (sidplay)
  • supported functionality
    • start and stop playback
    • interrupt previous sound to play new sound
    • enqueue new sound at end of previous sound
    • smooth fade-in/fade-out

audio event management

  • manage a set of events (basically just a name for each event)
  • manage a set of audio themes
    • each theme contains list of event->audio_file_name mappings
    • themes stored/managed via gconf
  • manage event sources
    • built-in event sources, e.g. touchscreen/button press
    • external event sources (e.g. gsmd, dbus, ...)

audio scenario management

  • e.g. dialer or even gsmd can request audio subsystem to switch to voicecall mode
  • this mainly affects codec/amplifier analog audio routing
  • integrated with bluetooth in case of BT headset or A2DP use
  • How is this management performed currently?

Important issues/pitfalls

Ringtone while headset playback

If the user is listening to music on the headset, do we want to mix the ring tones only into the headset audio, or actually interrupt and play it on the speaker?

Can be an option configurable by the user.

Personal tools

In the center of the Neo1973 audio subsystem is the WM8753 (the "Wolfson Codec"), which implements record (ADCs), playback (DACs), and signal mixing. On the stereo output is the LM4857 amplifier, which drives the stereo speakers, the mono earpiece and the headphones. Sound from and to GSM is received from and sent to the GSM modem via analog connections. There's a digital mono interface for sound from and to the Bluetooth chip.

Phase0 Quick Start

In my experience this works but I have to fiddle with the connection a bit before I get stereo output. The audio also comes out both the speaker and headphones.

alsactl -f /etc/stereoout.state restore
madplay myfavoritesong.mp3

Another simple test (assuming you have USB Networking configured) is to listen to a radio stream:

wget -O - http://radioparadise.steadyhost.com:8050 | madplay -

If for some reason you're missing stereoout.state, try getting a similar copy (a couple of volume levels are different is all)

 wget http://opensource.wolfsonmicro.com/~gg/neo1973/stereoout.state

Voice Calls

using phone-internal microphone and speaker

WM8753 BlockDiagram GSM handset.png

This is the default case.

  • microphone path
    • input: built in microphone attached to wolfson MIC2/MIC2N
    • routed from wolfson MIC2/MIC2N to MONO1/MONO2
    • arrives at GSM Modem input MICIP/MICIN
  • speaker path
    • input: GSM Modem attached to wolfson RXN/RXP
    • routed from wolfson RXN/RXP to ROUT1/LOUT1
    • arrives on LM4857 RIN/LIN
    • routed on LM4856 to EP+/EP-
Internal Codec Route

Neo Mode is GSM Handset Amp Mode is Call Speaker

  • audio path Mic -> GSM
    • MIC2/MIC2N
    • Mic2 Volume
    • ALC Micer Mic2
    • Left PGA
    • Mic Sidetone Mux [Left PGA]
    • Mono Sidetone Volume
    • Mono Mixer Sidetone Playback Switch
    • Mono Volume
    • Mono 2 Mux [Inverted Mono 1]
  • audio path GSM -> Speaker
    • RXP/RXN
    • Rx Mixer [RXP - RXN]
    • Line Left Mux [Rx Mix]/Line Right Mux [Rx Mix]
    • Left Mixer Bypass Playback Switch/Right Mixer Bypass Playback Switch
    • Headphone Volume
Driver Status

This should be supported by ASoC 0.13rc3 (-moko7 kernel) on.

ASoC 0.13.3 should have same functionality but has renamed the soundcard to neo1973.

asound.state

https://people.openmoko.org/laforge/gta01/gta01b_v2/alsa/gsmhandset.state

For ASoC 0.13.3 http://opensource.wolfsonmicro.com/~gg/neo1973/gsmhandset.state

using analog (4pin 2.5mm) headset

This is also a quite common case, since we ship the headset with the phone

Headset Detection is done via GPIO on S3C2410

  • microphone path
    • input: headset mic vial HS_MIC attached to wolfson MIC1
    • routed from wolfson MIC1 to MONO1/MONO2
    • arrives at GSM Modem input MICIP/MICIN
  • speaker path
    • input: GSM Modem attached to wolfson RXN/RXP
    • routed from wolfson RXN/RXP to ROUT1/LOUT1
    • arrives on LM4857 RIN/LIN
    • routed on LM4856 to LHP/RHP
Internal Codec Route

Neo Mode is GSM Headset Amp Mode is Headphones

  • audio path Mic -> GSM
    • MIC1
    • Mic Selection Mux [Mic 1]
    • ALC Mixer Mic1
    • Left PGA
    • Mic Sidetone Mux [Left PGA]
    • Mono Sidetone Volume
    • Mono Mixer Sidetone Playback Switch
    • Mono Volume
    • Mono 2 Mux [Inverted Mono 1]
  • Audio path GSM -> Headphones
    • RXP/RXN
    • Rx Mixer [RXP - RXN]
    • Line Left Mux [Rx Mix]/Line Right Mux [Rx Mix]
    • Left Mixer Bypass Playback Switch/Right Mixer Bypass Playback Switch
    • Headphone Volume
Driver Status

Supported in ASoC 0.13.3

asound.state

http://opensource.wolfsonmicro.com/~gg/neo1973/gsmheadset.state

using Bluetooth headset with GSM

WM8753 BlockDiagram GSM Bluetooth.png

Headset detection via software

  • microphone path
    • input: from bluetooth via PCM interface to wolfson
    • wolfson: DAC
    • wolfson routes analog signal to MONO1/MONO2
    • arrives at GSM Modem input MICIP/MICIN
  • speaker path
    • input: GSM Modem attached to wolfson RXN/RXP
    • wolfson: ADC
    • wolfson: routes digital signal to PCM
    • arrives on bluetooth chip via PCM
Internal Codec Route

Neo Mode is GSM Bluetooth Amp Mode is Off

  • audio path BT -> GSM
    • Vx DAC
    • Mono Voice Volume
    • Mono Mixer Voice Playback Switch
    • Mono Volume
    • Mono 2 Mux [Inverted Mono 1]
  • audio path GSM -> BT
    • RXP/RXN
    • Rx Mixer [RXP - RXN]
    • ALC Mixer Rx
    • Left PGA
    • Capture Mixer Mux [PGA]
    • Capture Left Mixer [Analogue Mix Left]
    • Left ADC
Driver Status

Should be support by ASoC 0.13.3

Example of how to setup PCM->BT link.

http://opensource.wolfsonmicro.com/~gg/bluetooth-pcm/bluetooth_pcm.c

asound.state

http://opensource.wolfsonmicro.com/~gg/neo1973/gsmbluetooth.state

Bluetooth headset with system audio

For example, using a voip app on the phone with a bt voice headset. This would also be a good way to work on the bluetooth driver without requiring a working GSM and placing a lot of calls.

See ticket 583 for a state file that should route system audio *out* to the headset. The codec does not allow for duplex system audio connected to a headset, so audio in is still using the mic.

Multimedia

sound playback to speakers

This is an important mode since it is also required for ringtone playback

  • speaker path
    • input: from S3C2410 via IIS interface to wolfson
    • wolfson: DAC
    • wolfson: route to ROUT1/LOUT1
    • LM4857: arrives on RIN/LIN
    • LM4857: route to LLS+-/RLS+-
Driver Status

This is working since ASoC 0.13rc2 (-moko6 kernel)

This should also work on ASoC 0.13.3

asound.state

https://people.openmoko.org/laforge/gta01/gta01b_v2/alsa/stereoout.state

For ASoC 0.13.3 http://opensource.wolfsonmicro.com/~gg/neo1973/stereoout.state

sound playback to headphone

  • speaker path
    • input: from S3C2410 via IIS interface to wolfson
    • wolfson: DAC
    • wolfson: route to ROUT1/LOUT1
    • LM4857: arrives on RIN/LIN
    • routed on LM4856 to LHP/RHP
Driver Status

This is working since ASoC 0.13rc2 (-moko6 kernel)

sound playback via A2DP

One way to do this is to use a pulse plugin for bluetooth audio. Pulse would be routed either to the plugin or the default route to the codec. The plugin would watch for headset connect/disconnect events generated by a bluez audio daemon to keep the list of available output devices current.

Driver Status

There is early work on the bluez daemon to handle this. It has been combined with an alsa plugin in the bluez tree but the alsa plugin probably will not be sufficient for neo.

voice recording

This is mainly used to record notes

  • microphone path
    • can be from built-in mic
    • or from headset
    • or bluetooth headset
Driver Status

UNKNOWN

Call recording

This is a nice wishlist item. The user should be able to receive the full-duplex audio from the wolfson codec, and record it using the S3C2410 IIS.

recording

FIXME

Driver Status

UNKNOWN

playback

FIXME

Driver Status

UNKNOWN

Userspace Sound Control Daemon

The userspace sound control deamon might be a separate process or (more likely) part of some larger general hardware management daemon.


It will provide the following features:

audio playback

In order to provide the desired functionality, the daemon first needs to be capable of doing audio playback.

  • supported formats
    • mp3 (libmad)
    • ogg/vorbis (libtremor)
    • mod (mikmod)
    • sid (sidplay)
  • supported functionality
    • start and stop playback
    • interrupt previous sound to play new sound
    • enqueue new sound at end of previous sound
    • smooth fade-in/fade-out

audio event management

  • manage a set of events (basically just a name for each event)
  • manage a set of audio themes
    • each theme contains list of event->audio_file_name mappings
    • themes stored/managed via gconf
  • manage event sources
    • built-in event sources, e.g. touchscreen/button press
    • external event sources (e.g. gsmd, dbus, ...)

audio scenario management

  • e.g. dialer or even gsmd can request audio subsystem to switch to voicecall mode
  • this mainly affects codec/amplifier analog audio routing
  • integrated with bluetooth in case of BT headset or A2DP use
  • How is this management performed currently?

Important issues/pitfalls

Ringtone while headset playback

If the user is listening to music on the headset, do we want to mix the ring tones only into the headset audio, or actually interrupt and play it on the speaker?

Can be an option configurable by the user.